Spaces:
Runtime error
Runtime error
Commit ·
0122af1
1
Parent(s): 560a81c
Hide uvicorn in subprocess to bypass ZeroGPU
Browse files
app.py
CHANGED
|
@@ -37,5 +37,6 @@ with gr.Blocks() as demo:
|
|
| 37 |
app = gr.mount_gradio_app(fastapi_app, demo, path="/gradio")
|
| 38 |
|
| 39 |
if __name__ == "__main__":
|
| 40 |
-
port =
|
| 41 |
-
|
|
|
|
|
|
| 37 |
app = gr.mount_gradio_app(fastapi_app, demo, path="/gradio")
|
| 38 |
|
| 39 |
if __name__ == "__main__":
|
| 40 |
+
port = os.getenv("PORT", "7860")
|
| 41 |
+
# Use subprocess to run Uvicorn to hide it from ZeroGPU's patcher
|
| 42 |
+
subprocess.Popen([sys.executable, "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", port]).wait()
|