Cascade Bot commited on
Commit
c855a5a
Β·
1 Parent(s): d2d63a6

fix: update server configuration and asset handling

Browse files

- Switch to Gradio's launch method with proper configuration
- Disable unnecessary asset loading
- Configure proper queue and threading
- Improve interface initialization

Files changed (1) hide show
  1. app.py +24 -11
app.py CHANGED
@@ -194,7 +194,9 @@ class ChatInterface:
194
  def create_interface(self) -> gr.Blocks:
195
  """Create the Gradio interface."""
196
  with gr.Blocks(
197
- title="Advanced Agentic System"
 
 
198
  ) as interface:
199
  gr.Markdown("""
200
  # πŸ€– Advanced Agentic System Chat Interface
@@ -216,16 +218,20 @@ class ChatInterface:
216
  """)
217
 
218
  chatbot = gr.Chatbot(
219
- show_label=False,
 
220
  height=500,
221
- type="messages" # Use OpenAI-style message format
 
 
222
  )
223
 
224
  with gr.Row():
225
  msg = gr.Textbox(
226
  show_label=False,
227
  placeholder="Chat with the Agentic System...",
228
- container=False
 
229
  )
230
  submit = gr.Button("Send πŸš€")
231
 
@@ -498,11 +504,18 @@ interface = create_chat_interface()
498
  app = gr.mount_gradio_app(app, interface, path="/")
499
 
500
  if __name__ == "__main__":
501
- # Run with uvicorn when called directly
502
- uvicorn.run(
503
- "app:app",
504
- host="0.0.0.0",
505
- port=7860,
506
- reload=True,
507
- workers=4
 
 
 
 
 
 
 
508
  )
 
194
  def create_interface(self) -> gr.Blocks:
195
  """Create the Gradio interface."""
196
  with gr.Blocks(
197
+ title="Advanced Agentic System",
198
+ css=None, # Disable custom CSS
199
+ theme=gr.themes.Soft(), # Use built-in theme
200
  ) as interface:
201
  gr.Markdown("""
202
  # πŸ€– Advanced Agentic System Chat Interface
 
218
  """)
219
 
220
  chatbot = gr.Chatbot(
221
+ value=[], # Initialize with empty list
222
+ type="messages", # Use OpenAI-style message format
223
  height=500,
224
+ show_label=False,
225
+ render_markdown=True,
226
+ avatar_images=None, # Disable avatars to prevent asset loading issues
227
  )
228
 
229
  with gr.Row():
230
  msg = gr.Textbox(
231
  show_label=False,
232
  placeholder="Chat with the Agentic System...",
233
+ container=False,
234
+ autofocus=True,
235
  )
236
  submit = gr.Button("Send πŸš€")
237
 
 
504
  app = gr.mount_gradio_app(app, interface, path="/")
505
 
506
  if __name__ == "__main__":
507
+ chat_interface = ChatInterface()
508
+ interface = chat_interface.create_interface()
509
+ interface.queue()
510
+ interface.launch(
511
+ server_name="0.0.0.0",
512
+ server_port=7860,
513
+ share=True,
514
+ debug=True,
515
+ enable_queue=True,
516
+ show_error=True,
517
+ favicon_path=None, # Disable favicon to prevent 404
518
+ show_api=False, # Disable API docs to reduce asset loading
519
+ reload=False, # Disable auto-reload to use workers properly
520
+ max_threads=40,
521
  )