Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,18 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 7 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
|
| 4 |
+
# Load a free chatbot model from Hugging Face
|
| 5 |
+
chatbot = pipeline("conversational", model="facebook/blenderbot_small-90M")
|
| 6 |
+
|
| 7 |
+
def chat(message, history=[]):
|
| 8 |
+
from transformers import Conversation
|
| 9 |
+
conversation = Conversation(message)
|
| 10 |
+
chatbot(conversation)
|
| 11 |
+
response = conversation.generated_responses[-1]
|
| 12 |
+
return response
|
| 13 |
+
|
| 14 |
+
with gr.Blocks() as demo:
|
| 15 |
+
gr.Markdown("## 🤖 Sumit AI Chatbot")
|
| 16 |
+
chatbox = gr.ChatInterface(fn=chat)
|
| 17 |
|
|
|
|
| 18 |
demo.launch()
|