Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
|
5 |
-
|
6 |
|
7 |
-
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
|
|
|
1 |
+
import whisper
|
2 |
+
from fastapi import FastAPI, UploadFile
|
3 |
+
from fastapi.responses import PlainTextResponse
|
4 |
|
5 |
+
app = FastAPI()
|
6 |
|
7 |
+
model = whisper.load_model("large")
|
8 |
|
9 |
+
@app.post("/transcribe/")
|
10 |
+
async def transcribe(file: UploadFile):
|
11 |
+
audio = await file.read()
|
12 |
+
result = model.transcribe(audio, language="es")
|
13 |
+
return PlainTextResponse(result['text'])
|
14 |
|