Spaces:
Sleeping
Sleeping
update api & docker
Browse files- Dockerfile +1 -1
- api.py +3 -3
Dockerfile
CHANGED
|
@@ -10,7 +10,7 @@ RUN pip install --no-cache-dir -r requirements/main.txt
|
|
| 10 |
|
| 11 |
EXPOSE 7860
|
| 12 |
|
| 13 |
-
ENV TEMP_DIR=/app/
|
| 14 |
ENV MODELS_DIR=/app/models
|
| 15 |
ENV NUMBA_CACHE_DIR=/tmp/numba_cache
|
| 16 |
ENV NUMBA_DISABLE_CACHING=1
|
|
|
|
| 10 |
|
| 11 |
EXPOSE 7860
|
| 12 |
|
| 13 |
+
ENV TEMP_DIR=/app/outputs
|
| 14 |
ENV MODELS_DIR=/app/models
|
| 15 |
ENV NUMBA_CACHE_DIR=/tmp/numba_cache
|
| 16 |
ENV NUMBA_DISABLE_CACHING=1
|
api.py
CHANGED
|
@@ -93,7 +93,7 @@ async def tts_api(req: TTSRequest):
|
|
| 93 |
raise HTTPException(status_code=404, detail=f"Index file not found: {index_path}")
|
| 94 |
|
| 95 |
# Path output
|
| 96 |
-
output_dir = "/app/
|
| 97 |
os.makedirs(output_dir, exist_ok=True)
|
| 98 |
limit_tts_files(output_dir, max_files=10)
|
| 99 |
tts_wav = f"{output_dir}/{uuid4().hex}_tts.wav"
|
|
@@ -157,8 +157,8 @@ async def tts_api(req: TTSRequest):
|
|
| 157 |
|
| 158 |
@app.get("/file-tmp")
|
| 159 |
def get_tmp_file(path: str):
|
| 160 |
-
# Security: hanya izinkan akses file di /
|
| 161 |
-
if not path.startswith("/
|
| 162 |
raise HTTPException(status_code=403, detail="Forbidden")
|
| 163 |
if not os.path.isfile(path):
|
| 164 |
raise HTTPException(status_code=404, detail="File not found")
|
|
|
|
| 93 |
raise HTTPException(status_code=404, detail=f"Index file not found: {index_path}")
|
| 94 |
|
| 95 |
# Path output
|
| 96 |
+
output_dir = "/app/outputs"
|
| 97 |
os.makedirs(output_dir, exist_ok=True)
|
| 98 |
limit_tts_files(output_dir, max_files=10)
|
| 99 |
tts_wav = f"{output_dir}/{uuid4().hex}_tts.wav"
|
|
|
|
| 157 |
|
| 158 |
@app.get("/file-tmp")
|
| 159 |
def get_tmp_file(path: str):
|
| 160 |
+
# Security: hanya izinkan akses file di /app/outputs
|
| 161 |
+
if not path.startswith("/app/outputs/"):
|
| 162 |
raise HTTPException(status_code=403, detail="Forbidden")
|
| 163 |
if not os.path.isfile(path):
|
| 164 |
raise HTTPException(status_code=404, detail="File not found")
|