demetz commited on
Commit
3ae53af
·
verified ·
1 Parent(s): 3671edc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -5
app.py CHANGED
@@ -105,11 +105,18 @@ with gr.Blocks(theme=theme) as chatbot:
105
 
106
  with gr.Tab("Step 2"):
107
  with gr.Column(scale=2):
108
- gr.ChatInterface(
109
- fn=respond,
110
- additional_inputs=[character_name, character_class, character_race, character_alignment], # Pass name into function!
111
- type="messages",
112
- examples=None
 
 
 
 
113
  )
 
 
 
114
 
115
  chatbot.launch()
 
105
 
106
  with gr.Tab("Step 2"):
107
  with gr.Column(scale=2):
108
+ chatbot_display = gr.Chatbot(label="Gorf the Frog Druid 🐸")
109
+ message_box = gr.Textbox(placeholder="Ask Gorf anything...", label="Your Message")
110
+ send_button = gr.Button("Send")
111
+ history_state = gr.State([])
112
+
113
+ send_button.click(
114
+ respond,
115
+ inputs=[message_box, history_state, character_name, character_class, character_race, character_alignment],
116
+ outputs=[chatbot_display, history_state]
117
  )
118
+
119
+ # Optional: clear textbox after sending
120
+ send_button.click(fn=lambda: "", inputs=None, outputs=message_box)
121
 
122
  chatbot.launch()