Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -18,31 +18,20 @@ def chat_function(message, history):
|
|
18 |
f"User Input: {message}"
|
19 |
)
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
)
|
26 |
-
|
27 |
-
context += f"User: {message}\nAI: {response}\n"
|
28 |
-
history.append((message, response))
|
29 |
-
|
30 |
-
return "", history
|
31 |
|
32 |
-
|
33 |
-
|
34 |
|
35 |
-
|
36 |
-
global context
|
37 |
-
context = ""
|
38 |
-
return [], ""
|
39 |
|
40 |
with gr.Blocks(theme=gr.themes.Glass()) as demo:
|
41 |
chatbot = gr.Chatbot()
|
42 |
msg = gr.Textbox(placeholder="Message Z3ta...")
|
43 |
-
clear = gr.Button("Clear")
|
44 |
|
45 |
msg.submit(chat_function, [msg, chatbot], [msg, chatbot])
|
46 |
-
clear.click(reset_context, [], [chatbot, msg])
|
47 |
|
48 |
demo.launch()
|
|
|
18 |
f"User Input: {message}"
|
19 |
)
|
20 |
|
21 |
+
response = client.predict(
|
22 |
+
message=modified_input,
|
23 |
+
api_name="/chat"
|
24 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
+
context += f"User: {message}\nAI: {response}\n"
|
27 |
+
history.append((message, response))
|
28 |
|
29 |
+
return "", history
|
|
|
|
|
|
|
30 |
|
31 |
with gr.Blocks(theme=gr.themes.Glass()) as demo:
|
32 |
chatbot = gr.Chatbot()
|
33 |
msg = gr.Textbox(placeholder="Message Z3ta...")
|
|
|
34 |
|
35 |
msg.submit(chat_function, [msg, chatbot], [msg, chatbot])
|
|
|
36 |
|
37 |
demo.launch()
|