filipvk commited on
Commit
154fd8f
·
1 Parent(s): 03d5e51

use persistent folder for output

Browse files
Files changed (1) hide show
  1. app/main.py +4 -4
app/main.py CHANGED
@@ -18,12 +18,12 @@ app = FastAPI(
18
  swagger_ui_parameters={"tryItOutEnabled": True},
19
  )
20
 
21
- # Folder for generated images
22
- OUTPUT_DIR = Path("outputs")
23
- OUTPUT_DIR.mkdir(exist_ok=True)
24
 
25
  # Serve generated files publicly
26
- app.mount("/outputs", StaticFiles(directory="outputs"), name="outputs")
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("/")