mtyrrell commited on
Commit
a326770
·
1 Parent(s): 7694daf

chatui troubleshoot

Browse files
Files changed (1) hide show
  1. app/main.py +23 -6
app/main.py CHANGED
@@ -505,6 +505,23 @@ if __name__ == "__main__":
505
  if is_hf_spaces:
506
  # On HF Spaces, just launch Gradio with API endpoints
507
  logger.info("🚀 Starting on Hugging Face Spaces")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
508
 
509
  # Add API endpoints to Gradio's FastAPI app
510
  @demo.app.get("/health")
@@ -515,13 +532,13 @@ if __name__ == "__main__":
515
  "api_endpoints": "available_via_gradio"
516
  }
517
 
518
- @demo.app.post("/chatfed")
519
- async def chatfed_endpoint(input_data: dict):
520
- return process_chatfed_query_langserve(input_data)
521
 
522
- @demo.app.post("/chatfed-chatui")
523
- async def chatui_endpoint(input_data: dict):
524
- return chatui_adapter(input_data)
525
 
526
  @demo.app.post("/process_query")
527
  async def process_query_endpoint(
 
505
  if is_hf_spaces:
506
  # On HF Spaces, just launch Gradio with API endpoints
507
  logger.info("🚀 Starting on Hugging Face Spaces")
508
+
509
+ # Register LangServe routes for ChatUI + main chatfed endpoint
510
+ @demo.app.on_event("startup")
511
+ async def startup_event():
512
+ add_routes(
513
+ demo.app,
514
+ chatui_adapter_runnable,
515
+ path="/chatfed-chatui",
516
+ input_type=ChatUIInput
517
+ )
518
+ add_routes(
519
+ demo.app,
520
+ process_chatfed_query_runnable,
521
+ path="/chatfed",
522
+ input_type=ChatFedInput,
523
+ output_type=ChatFedOutput
524
+ )
525
 
526
  # Add API endpoints to Gradio's FastAPI app
527
  @demo.app.get("/health")
 
532
  "api_endpoints": "available_via_gradio"
533
  }
534
 
535
+ # @demo.app.post("/chatfed")
536
+ # async def chatfed_endpoint(input_data: dict):
537
+ # return process_chatfed_query_langserve(input_data)
538
 
539
+ # @demo.app.post("/chatfed-chatui")
540
+ # async def chatui_endpoint(input_data: dict):
541
+ # return chatui_adapter(input_data)
542
 
543
  @demo.app.post("/process_query")
544
  async def process_query_endpoint(