Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
chat = pipeline("conversational", model="microsoft/DialoGPT-medium")
|
5 |
+
|
6 |
+
def respond(user_input):
|
7 |
+
from transformers import Conversation
|
8 |
+
conversation = Conversation(user_input)
|
9 |
+
chat(conversation)
|
10 |
+
return str(conversation.generated_responses[-1])
|
11 |
+
|
12 |
+
iface = gr.Interface(fn=respond,
|
13 |
+
inputs="text",
|
14 |
+
outputs="text",
|
15 |
+
title="KingofDanger Chatbot",
|
16 |
+
description="Ask anything 👑 powered by Hugging Face")
|
17 |
+
|
18 |
+
iface.launch()
|