Spaces:
Runtime error
Runtime error
Michael S. Trusov commited on
Commit ·
932e2b4
1
Parent(s): f05a578
July 18 commit to Hugging Face 10:48pm
Browse files
app.py
CHANGED
|
@@ -32,6 +32,8 @@ def download_file(filename: str, directory: str = "."):
|
|
| 32 |
print(f"File found: {file_path}")
|
| 33 |
return FileResponse(path=file_path, filename=filename)
|
| 34 |
|
|
|
|
|
|
|
| 35 |
def run_fastapi():
|
| 36 |
import uvicorn
|
| 37 |
from uvicorn import Config, Server
|
|
@@ -44,15 +46,19 @@ def run_fastapi():
|
|
| 44 |
server = CustomServer(config=config)
|
| 45 |
|
| 46 |
print("Starting FastAPI server... Version 4:51pm")
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
#--------------------------------------------------------------------------------
|
| 58 |
|
|
|
|
| 32 |
print(f"File found: {file_path}")
|
| 33 |
return FileResponse(path=file_path, filename=filename)
|
| 34 |
|
| 35 |
+
import multiprocessing
|
| 36 |
+
|
| 37 |
def run_fastapi():
|
| 38 |
import uvicorn
|
| 39 |
from uvicorn import Config, Server
|
|
|
|
| 46 |
server = CustomServer(config=config)
|
| 47 |
|
| 48 |
print("Starting FastAPI server... Version 4:51pm")
|
| 49 |
+
|
| 50 |
+
def start_server():
|
| 51 |
+
try:
|
| 52 |
+
print("In start_server before server.run")
|
| 53 |
+
server.run()
|
| 54 |
+
print("In start_server after server.run")
|
| 55 |
+
except Exception as e:
|
| 56 |
+
print(f"Failed to start FastAPI server: {e}")
|
| 57 |
+
|
| 58 |
+
p = multiprocessing.Process(target=start_server)
|
| 59 |
+
p.start()
|
| 60 |
+
print("Server process started")
|
| 61 |
+
|
| 62 |
|
| 63 |
#--------------------------------------------------------------------------------
|
| 64 |
|