Spaces:
Runtime error
Runtime error
Update main.py
Browse files
main.py
CHANGED
|
@@ -2,6 +2,7 @@ import torch
|
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
from fastapi import BackgroundTasks, File, UploadFile, FastAPI
|
|
|
|
| 5 |
|
| 6 |
MODEL_NAME = "openai/whisper-large-v2"
|
| 7 |
|
|
@@ -38,4 +39,10 @@ def get_text():
|
|
| 38 |
file = open('/home/user/data/new_file.txt', 'r')
|
| 39 |
content = file.read()
|
| 40 |
file.close()
|
| 41 |
-
return {"text": content}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
from fastapi import BackgroundTasks, File, UploadFile, FastAPI
|
| 5 |
+
from fastapi.responses import RedirectResponse
|
| 6 |
|
| 7 |
MODEL_NAME = "openai/whisper-large-v2"
|
| 8 |
|
|
|
|
| 39 |
file = open('/home/user/data/new_file.txt', 'r')
|
| 40 |
content = file.read()
|
| 41 |
file.close()
|
| 42 |
+
return {"text": content}
|
| 43 |
+
|
| 44 |
+
@app.get("/")
|
| 45 |
+
def read_root():
|
| 46 |
+
url = app.url_path_for("docs")
|
| 47 |
+
response = RedirectResponse(url=url)
|
| 48 |
+
return response
|