Spaces:
Running
Running
use persistent folder for output
Browse files- app/main.py +4 -4
app/main.py
CHANGED
|
@@ -18,12 +18,12 @@ app = FastAPI(
|
|
| 18 |
swagger_ui_parameters={"tryItOutEnabled": True},
|
| 19 |
)
|
| 20 |
|
| 21 |
-
#
|
| 22 |
-
OUTPUT_DIR = Path("
|
| 23 |
-
OUTPUT_DIR.mkdir(exist_ok=True)
|
| 24 |
|
| 25 |
# Serve generated files publicly
|
| 26 |
-
app.mount("/outputs", StaticFiles(directory=
|
| 27 |
|
| 28 |
|
| 29 |
@app.get("/")
|
|
|
|
| 18 |
swagger_ui_parameters={"tryItOutEnabled": True},
|
| 19 |
)
|
| 20 |
|
| 21 |
+
# Persistent folder inside HF Space workspace
|
| 22 |
+
OUTPUT_DIR = Path("/workspace/persistent_outputs")
|
| 23 |
+
OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
|
| 24 |
|
| 25 |
# Serve generated files publicly
|
| 26 |
+
app.mount("/outputs", StaticFiles(directory=str(OUTPUT_DIR)), name="outputs")
|
| 27 |
|
| 28 |
|
| 29 |
@app.get("/")
|