Spaces:
Runtime error
Runtime error
app
Browse files- app.py +22 -20
- requirements.txt +1 -2
app.py
CHANGED
@@ -52,16 +52,18 @@ def predict(input, history=[]):
|
|
52 |
bot_text = bot_text_temp
|
53 |
print("Bot: {}".format(bot_text))
|
54 |
|
|
|
|
|
55 |
# write some HTML
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
|
|
60 |
|
61 |
-
|
62 |
|
63 |
-
history
|
64 |
-
return history, history
|
65 |
|
66 |
import gradio as gr
|
67 |
|
@@ -73,17 +75,17 @@ css = """
|
|
73 |
.footer {display:none !important}
|
74 |
"""
|
75 |
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
|
82 |
-
chatbot = gr.Chatbot().style(color_map=("green", "pink"))
|
83 |
-
demo = gr.Interface(
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
)
|
89 |
-
demo.launch()
|
|
|
52 |
bot_text = bot_text_temp
|
53 |
print("Bot: {}".format(bot_text))
|
54 |
|
55 |
+
history.append((input, bot_text))
|
56 |
+
|
57 |
# write some HTML
|
58 |
+
html = "<div class='chatbot'>"
|
59 |
+
for chat in history:
|
60 |
+
html += "<div class='msg {}'> {}</div>".format("User", chat[0])
|
61 |
+
html += "<div class='msg {}'> {}</div>".format("Bot", chat[1])
|
62 |
+
html += "</div>"
|
63 |
|
64 |
+
return html, history
|
65 |
|
66 |
+
# return history, history
|
|
|
67 |
|
68 |
import gradio as gr
|
69 |
|
|
|
75 |
.footer {display:none !important}
|
76 |
"""
|
77 |
|
78 |
+
gr.Interface(fn=predict,
|
79 |
+
theme="default",
|
80 |
+
inputs=[gr.inputs.Textbox(placeholder="๋ฐฅ์ ๋จน์๋?"), "state"],
|
81 |
+
outputs=["html", "state"],
|
82 |
+
css=css).launch()
|
83 |
|
84 |
+
# chatbot = gr.Chatbot().style(color_map=("green", "pink"))
|
85 |
+
# demo = gr.Interface(
|
86 |
+
# predict,
|
87 |
+
# ["text", "state"],
|
88 |
+
# [chatbot, "state"],
|
89 |
+
# allow_flagging="never",
|
90 |
+
# )
|
91 |
+
# demo.launch()
|
requirements.txt
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
transformers
|
2 |
torch
|
3 |
-
nltk
|
4 |
-
gradio==3.4.0
|
|
|
1 |
transformers
|
2 |
torch
|
3 |
+
nltk
|
|