Spaces:
Runtime error
Runtime error
Commit Β·
a8d4641
1
Parent(s): 784922d
Run Lumen API on CPU Space runtime
Browse files
app.py
CHANGED
|
@@ -7,7 +7,6 @@ import threading
|
|
| 7 |
import queue as queue_mod
|
| 8 |
import uvicorn
|
| 9 |
import gradio as gr
|
| 10 |
-
import spaces
|
| 11 |
from fastapi import FastAPI, Request
|
| 12 |
from fastapi.responses import StreamingResponse, JSONResponse
|
| 13 |
from huggingface_hub import hf_hub_download
|
|
@@ -128,12 +127,6 @@ def _load_model():
|
|
| 128 |
threading.Thread(target=_load_model, daemon=True).start()
|
| 129 |
|
| 130 |
|
| 131 |
-
# ZeroGPU requires one decorated function even though inference stays on CPU.
|
| 132 |
-
@spaces.GPU
|
| 133 |
-
def _zerogpu_compatibility_marker():
|
| 134 |
-
return True
|
| 135 |
-
|
| 136 |
-
|
| 137 |
# ββ Gradio chat helpers βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 138 |
|
| 139 |
def user_submit(message, history):
|
|
@@ -468,7 +461,5 @@ if __name__ == "__main__":
|
|
| 468 |
uvicorn.run(
|
| 469 |
app,
|
| 470 |
host="0.0.0.0",
|
| 471 |
-
|
| 472 |
-
# selected 7861 automatically for this Space.
|
| 473 |
-
port=7861,
|
| 474 |
)
|
|
|
|
| 7 |
import queue as queue_mod
|
| 8 |
import uvicorn
|
| 9 |
import gradio as gr
|
|
|
|
| 10 |
from fastapi import FastAPI, Request
|
| 11 |
from fastapi.responses import StreamingResponse, JSONResponse
|
| 12 |
from huggingface_hub import hf_hub_download
|
|
|
|
| 127 |
threading.Thread(target=_load_model, daemon=True).start()
|
| 128 |
|
| 129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
# ββ Gradio chat helpers βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 131 |
|
| 132 |
def user_submit(message, history):
|
|
|
|
| 461 |
uvicorn.run(
|
| 462 |
app,
|
| 463 |
host="0.0.0.0",
|
| 464 |
+
port=int(os.environ.get("PORT", "7860")),
|
|
|
|
|
|
|
| 465 |
)
|