Spaces:
Sleeping
Sleeping
Commit ·
30d88ea
1
Parent(s): bf0de65
changed the way program starts
Browse files- Dockerfile +1 -1
- main.py +4 -0
Dockerfile
CHANGED
|
@@ -36,4 +36,4 @@ WORKDIR /app
|
|
| 36 |
|
| 37 |
EXPOSE 7860
|
| 38 |
# Run the script
|
| 39 |
-
CMD ["
|
|
|
|
| 36 |
|
| 37 |
EXPOSE 7860
|
| 38 |
# Run the script
|
| 39 |
+
CMD ["python", "main.py"]
|
main.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
from fastapi import FastAPI, BackgroundTasks
|
| 2 |
from fastapi.responses import FileResponse
|
| 3 |
from pydantic import BaseModel
|
|
@@ -81,3 +82,6 @@ def download_results(task_id: str):
|
|
| 81 |
shutil.make_archive(folder_path, 'zip', folder_path)
|
| 82 |
|
| 83 |
return FileResponse(zip_path, filename=f"{task_id}.zip", media_type="application/zip")
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import uvicorn
|
| 2 |
from fastapi import FastAPI, BackgroundTasks
|
| 3 |
from fastapi.responses import FileResponse
|
| 4 |
from pydantic import BaseModel
|
|
|
|
| 82 |
shutil.make_archive(folder_path, 'zip', folder_path)
|
| 83 |
|
| 84 |
return FileResponse(zip_path, filename=f"{task_id}.zip", media_type="application/zip")
|
| 85 |
+
|
| 86 |
+
if __name__ == "__main__":
|
| 87 |
+
uvicorn.run(app, host="0.0.0.0", port=7860)
|