Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,16 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 7 |
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
|
| 4 |
+
chatbot = pipeline("conversational", model="microsoft/DialoGPT-medium")
|
| 5 |
+
|
| 6 |
+
def chatbot_response(user_input):
|
| 7 |
+
response = chatbot(user_input)
|
| 8 |
+
return response[0]["generated_text"]
|
| 9 |
+
|
| 10 |
+
iface = gr.Interface(
|
| 11 |
+
fn=chatbot_response,
|
| 12 |
+
inputs=gr.inputs.Textbox(lines=2, placeholder="Type a message..."),
|
| 13 |
+
outputs="text"
|
| 14 |
+
)
|
| 15 |
|
|
|
|
| 16 |
iface.launch()
|