Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from transformers import pipeline
|
| 3 |
|
| 4 |
-
|
| 5 |
-
def respond(msg, history):
|
| 6 |
history = history or []
|
| 7 |
-
|
| 8 |
-
reply
|
| 9 |
-
history.append((msg, reply))
|
| 10 |
return history, history
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# app.py
|
| 2 |
import gradio as gr
|
|
|
|
| 3 |
|
| 4 |
+
def echo(message, history):
|
|
|
|
| 5 |
history = history or []
|
| 6 |
+
reply = f"Ты написал: {message}"
|
| 7 |
+
history.append((message, reply))
|
|
|
|
| 8 |
return history, history
|
| 9 |
+
|
| 10 |
+
demo = gr.ChatInterface(
|
| 11 |
+
fn=echo,
|
| 12 |
+
type="messages",
|
| 13 |
+
examples=["Привет", "Как дела?", "Расскажи шутку"],
|
| 14 |
+
title="Echo Bot на Gradio"
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
+
if __name__ == "__main__":
|
| 18 |
+
demo.launch()
|