Spaces:
Sleeping
Sleeping
j
commited on
Commit
·
8a75d3b
1
Parent(s):
ed52f78
add ls endpoint
Browse files- Dockerfile +2 -1
- app/list_files.html +14 -0
- app/webservice.py +11 -0
Dockerfile
CHANGED
|
@@ -57,7 +57,8 @@ RUN $POETRY_VENV/bin/pip install --no-cache-dir torch==1.13.1+cu117 -f https://d
|
|
| 57 |
WORKDIR /app/reascripts/ReaSpeech
|
| 58 |
RUN make publish
|
| 59 |
WORKDIR /app
|
| 60 |
-
|
|
|
|
| 61 |
|
| 62 |
|
| 63 |
|
|
|
|
| 57 |
WORKDIR /app/reascripts/ReaSpeech
|
| 58 |
RUN make publish
|
| 59 |
WORKDIR /app
|
| 60 |
+
|
| 61 |
+
ENTRYPOINT ["python3", "app/run.py"]
|
| 62 |
|
| 63 |
|
| 64 |
|
app/list_files.html
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<html>
|
| 2 |
+
<head>
|
| 3 |
+
<title>Files</title>
|
| 4 |
+
</head>
|
| 5 |
+
<body>
|
| 6 |
+
<h1>Files:</h1>
|
| 7 |
+
<ul>
|
| 8 |
+
{% for file in files %}
|
| 9 |
+
<li><a href="{{file}}">{{file}}</a></li>
|
| 10 |
+
{% endfor %}
|
| 11 |
+
</ul>
|
| 12 |
+
</body>
|
| 13 |
+
</html>
|
| 14 |
+
|
app/webservice.py
CHANGED
|
@@ -159,6 +159,17 @@ async def asr(
|
|
| 159 |
'Asr-Engine': ASR_ENGINE,
|
| 160 |
'Content-Disposition': f'attachment; filename="{filename}"'
|
| 161 |
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
|
| 163 |
@app.get("/jobs/{job_id}", tags=["Endpoints"])
|
| 164 |
async def job_status(job_id: str):
|
|
|
|
| 159 |
'Asr-Engine': ASR_ENGINE,
|
| 160 |
'Content-Disposition': f'attachment; filename="{filename}"'
|
| 161 |
})
|
| 162 |
+
|
| 163 |
+
@app.get("/static", response_class=HTMLResponse)
|
| 164 |
+
def list_files(request: Request):
|
| 165 |
+
|
| 166 |
+
files = os.listdir("./static")
|
| 167 |
+
files_paths = sorted([f"{request.url._url}/{f}" for f in files])
|
| 168 |
+
print(files_paths)
|
| 169 |
+
return templates.TemplateResponse(
|
| 170 |
+
"list_files.html", {"request": request, "files": files_paths}
|
| 171 |
+
)
|
| 172 |
+
|
| 173 |
|
| 174 |
@app.get("/jobs/{job_id}", tags=["Endpoints"])
|
| 175 |
async def job_status(job_id: str):
|