KaiShin1885 commited on
Commit
9e64cc6
·
verified ·
1 Parent(s): 9cbb57b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -15,17 +15,17 @@ def chatbot(input_text):
15
  predicted_class = logits.argmax(-1)[0]
16
 
17
  # Generate response based on predicted class
18
- if predicted_class == 0:
19
- response = "I'm happy to help you with that!"
20
- elif predicted_class == 1:
21
- response = "I'm not sure I understand. Can you please rephrase?"
22
- else:
23
- response = "I'm sorry, I'm not trained to respond to that."
24
 
25
  return response
26
 
27
  # Create Gradio interface
28
- demo = gr.Interface(
29
  fn=chatbot,
30
  inputs="text",
31
  outputs="text",
@@ -34,4 +34,4 @@ demo = gr.Interface(
34
  )
35
 
36
  # Launch Gradio app
37
- demo.launch()
 
15
  predicted_class = logits.argmax(-1)[0]
16
 
17
  # Generate response based on predicted class
18
+ responses = [
19
+ "I'm happy to help you with that!",
20
+ "I'm not sure I understand. Can you please rephrase?",
21
+ "I'm sorry, I'm not trained to respond to that."
22
+ ]
23
+ response = responses[predicted_class]
24
 
25
  return response
26
 
27
  # Create Gradio interface
28
+ iface = gr.Interface(
29
  fn=chatbot,
30
  inputs="text",
31
  outputs="text",
 
34
  )
35
 
36
  # Launch Gradio app
37
+ iface.launch()