Commit
·
94b73ef
unverified
·
0
Parent(s):
ahoy
Browse files- Dockerfile +11 -0
- __pycache__/main.cpython-310.pyc +0 -0
- main.py +22 -0
- requirements.txt +18 -0
Dockerfile
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.10
|
| 2 |
+
|
| 3 |
+
WORKDIR /code
|
| 4 |
+
|
| 5 |
+
COPY ./requirements.txt /code/requirements.txt
|
| 6 |
+
|
| 7 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 8 |
+
|
| 9 |
+
COPY . .
|
| 10 |
+
|
| 11 |
+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
__pycache__/main.cpython-310.pyc
ADDED
|
Binary file (943 Bytes). View file
|
|
|
main.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import replicate
|
| 2 |
+
from pydantic import BaseModel
|
| 3 |
+
from fastapi import FastAPI
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
class URLPayload(BaseModel):
|
| 7 |
+
url: str
|
| 8 |
+
|
| 9 |
+
app = FastAPI()
|
| 10 |
+
|
| 11 |
+
def process_audio(url: str):
|
| 12 |
+
deployment = replicate.deployments.get("meal/incredibly-fast-whisper")
|
| 13 |
+
prediction = deployment.predictions.create(
|
| 14 |
+
input={ "audio": url }
|
| 15 |
+
)
|
| 16 |
+
prediction.wait()
|
| 17 |
+
return prediction.output
|
| 18 |
+
|
| 19 |
+
@app.post("/process/")
|
| 20 |
+
async def process_audio_endpoint(payload: URLPayload):
|
| 21 |
+
result = process_audio(payload.url)
|
| 22 |
+
return result
|
requirements.txt
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
annotated-types==0.6.0
|
| 2 |
+
anyio==4.2.0
|
| 3 |
+
certifi==2023.11.17
|
| 4 |
+
click==8.1.7
|
| 5 |
+
exceptiongroup==1.2.0
|
| 6 |
+
fastapi==0.108.0
|
| 7 |
+
h11==0.14.0
|
| 8 |
+
httpcore==1.0.2
|
| 9 |
+
httpx==0.26.0
|
| 10 |
+
idna==3.6
|
| 11 |
+
packaging==23.2
|
| 12 |
+
pydantic==2.5.3
|
| 13 |
+
pydantic_core==2.14.6
|
| 14 |
+
replicate==0.22.0
|
| 15 |
+
sniffio==1.3.0
|
| 16 |
+
starlette==0.32.0.post1
|
| 17 |
+
typing_extensions==4.9.0
|
| 18 |
+
uvicorn==0.25.0
|