Spaces:
Runtime error
Runtime error
charlie0608
commited on
Commit
•
0d7a300
1
Parent(s):
e255f7c
Update app/main.py
Browse files- app/main.py +14 -1
app/main.py
CHANGED
@@ -1,7 +1,20 @@
|
|
1 |
from fastapi import FastAPI
|
|
|
2 |
|
3 |
app = FastAPI()
|
4 |
|
5 |
@app.get("/")
|
6 |
def root():
|
7 |
-
return {"Hello": "World"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
from fastapi import FastAPI
|
2 |
+
import speech_to_text from whisper
|
3 |
|
4 |
app = FastAPI()
|
5 |
|
6 |
@app.get("/")
|
7 |
def root():
|
8 |
+
return {"Hello": "World"}
|
9 |
+
|
10 |
+
@app.post("/upload/")
|
11 |
+
async def create_upload_file(file: UploadFile = File(...)):
|
12 |
+
|
13 |
+
# Process the file here
|
14 |
+
content = await file.read()
|
15 |
+
|
16 |
+
with open("tempfile.wav", "wb") as f:
|
17 |
+
f.write(contents)
|
18 |
+
response_text = speech_to_text("tempfile.wav")
|
19 |
+
|
20 |
+
return PlainTextResponse(content=response_text, status_code=200)
|