TejAndrewsACC commited on
Commit
2e7c967
·
verified ·
1 Parent(s): b8c0f54

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -18
app.py CHANGED
@@ -18,31 +18,20 @@ def chat_function(message, history):
18
  f"User Input: {message}"
19
  )
20
 
21
- try:
22
- response = client.predict(
23
- message=modified_input,
24
- api_name="/chat"
25
- )
26
-
27
- context += f"User: {message}\nAI: {response}\n"
28
- history.append((message, response))
29
-
30
- return "", history
31
 
32
- except Exception as e:
33
- return f"Error: {e}", history
34
 
35
- def reset_context():
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()