JatsTheAIGen commited on
Commit
f96d28a
·
1 Parent(s): c5e8f57

Initial commit V6

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -226,6 +226,15 @@ def create_mobile_optimized_interface():
226
  )
227
 
228
  gr.Button("Save Preferences", variant="primary")
 
 
 
 
 
 
 
 
 
229
 
230
  return demo, interface_components
231
 
@@ -292,15 +301,6 @@ else:
292
  if __name__ == "__main__":
293
  demo, components = create_mobile_optimized_interface()
294
 
295
- # Wire up the submit handler
296
- if 'send_btn' in components and 'message_input' in components and 'chatbot' in components:
297
- # Connect the submit handler with the GPU-decorated function
298
- components['send_btn'].click(
299
- fn=chat_handler_fn,
300
- inputs=[components['message_input'], components['chatbot']],
301
- outputs=[components['chatbot'], components['message_input']]
302
- )
303
-
304
  # Launch the app
305
  demo.launch(
306
  server_name="0.0.0.0",
 
226
  )
227
 
228
  gr.Button("Save Preferences", variant="primary")
229
+
230
+ # Wire up the submit handler INSIDE the gr.Blocks context
231
+ if 'send_btn' in interface_components and 'message_input' in interface_components and 'chatbot' in interface_components:
232
+ # Connect the submit handler with the GPU-decorated function
233
+ interface_components['send_btn'].click(
234
+ fn=chat_handler_fn,
235
+ inputs=[interface_components['message_input'], interface_components['chatbot']],
236
+ outputs=[interface_components['chatbot'], interface_components['message_input']]
237
+ )
238
 
239
  return demo, interface_components
240
 
 
301
  if __name__ == "__main__":
302
  demo, components = create_mobile_optimized_interface()
303
 
 
 
 
 
 
 
 
 
 
304
  # Launch the app
305
  demo.launch(
306
  server_name="0.0.0.0",