yukee1992 commited on
Commit
832cd68
ยท
verified ยท
1 Parent(s): 5eee929

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -835,7 +835,7 @@ async def test_endpoint():
835
  "timestamp": datetime.now().isoformat()
836
  }
837
 
838
- # For Hugging Face Spaces deployment - SIMPLIFIED APPROACH
839
  def get_app():
840
  return app
841
 
@@ -852,9 +852,8 @@ if __name__ == "__main__":
852
  print("๐ŸŽจ Web interface available at: /ui")
853
  print("๐Ÿ”Œ Both API and UI running on same port")
854
 
855
- # On Hugging Face Spaces, we need to properly integrate both
856
- # Mount Gradio app to FastAPI
857
- app = gr.mount_gradio_app(app, gradio_app, path="/ui")
858
 
859
  # Run the combined app
860
  uvicorn.run(
@@ -904,5 +903,4 @@ if __name__ == "__main__":
904
  while True:
905
  time.sleep(1)
906
  except KeyboardInterrupt:
907
- print("๐Ÿ›‘ Shutting down servers...")
908
-
 
835
  "timestamp": datetime.now().isoformat()
836
  }
837
 
838
+ # For Hugging Face Spaces deployment - FIXED APPROACH
839
  def get_app():
840
  return app
841
 
 
852
  print("๐ŸŽจ Web interface available at: /ui")
853
  print("๐Ÿ”Œ Both API and UI running on same port")
854
 
855
+ # FIX: Properly mount Gradio without reassigning app
856
+ gr.mount_gradio_app(app, gradio_app, path="/ui")
 
857
 
858
  # Run the combined app
859
  uvicorn.run(
 
903
  while True:
904
  time.sleep(1)
905
  except KeyboardInterrupt:
906
+ print("๐Ÿ›‘ Shutting down servers...")