poseidon666 commited on
Commit
dcdbf14
·
verified ·
1 Parent(s): 29c6641

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. app.py +1 -0
  2. server/app.py +5 -4
app.py CHANGED
@@ -12,6 +12,7 @@ _HERE = os.path.dirname(os.path.abspath(__file__))
12
  if _HERE not in sys.path:
13
  sys.path.insert(0, _HERE)
14
 
 
15
  from server.app import app
16
 
17
  # The 'app' variable is what Hugging Face Spaces will look for
 
12
  if _HERE not in sys.path:
13
  sys.path.insert(0, _HERE)
14
 
15
+ # Import the mounted FastAPI+Gradio app
16
  from server.app import app
17
 
18
  # The 'app' variable is what Hugging Face Spaces will look for
server/app.py CHANGED
@@ -249,18 +249,19 @@ def create_gradio_app() -> gr.Blocks:
249
 
250
 
251
  # ---------------------------------------------------------------------------
252
- # Create Gradio app and launch
253
  # ---------------------------------------------------------------------------
254
  demo = create_gradio_app()
255
 
256
- # For HF Spaces, we need to expose the Gradio app directly
257
- app = demo
258
 
259
  # ---------------------------------------------------------------------------
260
  # Entry Point
261
  # ---------------------------------------------------------------------------
262
  def main():
263
- demo.launch(server_name="0.0.0.0", server_port=8000)
 
264
 
265
  if __name__ == "__main__":
266
  main()
 
249
 
250
 
251
  # ---------------------------------------------------------------------------
252
+ # Create Gradio app and mount to FastAPI
253
  # ---------------------------------------------------------------------------
254
  demo = create_gradio_app()
255
 
256
+ # Mount Gradio to FastAPI at root path
257
+ app = gr.mount_gradio_app(fastapi_app, demo, path="/")
258
 
259
  # ---------------------------------------------------------------------------
260
  # Entry Point
261
  # ---------------------------------------------------------------------------
262
  def main():
263
+ import uvicorn
264
+ uvicorn.run(app, host="0.0.0.0", port=8000)
265
 
266
  if __name__ == "__main__":
267
  main()