Spaces:
Sleeping
Sleeping
test
Browse files- app.py +11 -0
- requirements.txt +3 -1
app.py
CHANGED
|
@@ -1,8 +1,19 @@
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
from transformers import VitsModel, AutoTokenizer
|
| 3 |
import torch
|
|
|
|
|
|
|
| 4 |
app = FastAPI()
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
model = VitsModel.from_pretrained("facebook/mms-tts-eng")
|
| 7 |
tokenizer = AutoTokenizer.from_pretrained("facebook/mms-tts-eng")
|
| 8 |
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
from transformers import VitsModel, AutoTokenizer
|
| 3 |
import torch
|
| 4 |
+
from fastapi.middleware.cors import CORSMiddleware
|
| 5 |
+
|
| 6 |
app = FastAPI()
|
| 7 |
|
| 8 |
+
# Allow specific domains or all (*) for testing
|
| 9 |
+
app.add_middleware(
|
| 10 |
+
CORSMiddleware,
|
| 11 |
+
allow_origins=["https://translate.piyazon.top/", "*"], # Replace with your domain
|
| 12 |
+
allow_credentials=True,
|
| 13 |
+
allow_methods=["*"],
|
| 14 |
+
allow_headers=["*"],
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
model = VitsModel.from_pretrained("facebook/mms-tts-eng")
|
| 18 |
tokenizer = AutoTokenizer.from_pretrained("facebook/mms-tts-eng")
|
| 19 |
|
requirements.txt
CHANGED
|
@@ -9,4 +9,6 @@ tensorboard
|
|
| 9 |
Cython
|
| 10 |
torch==2.7.1
|
| 11 |
torchaudio==2.7.1
|
| 12 |
-
torchcodec==0.5
|
|
|
|
|
|
|
|
|
| 9 |
Cython
|
| 10 |
torch==2.7.1
|
| 11 |
torchaudio==2.7.1
|
| 12 |
+
torchcodec==0.5
|
| 13 |
+
flask
|
| 14 |
+
flask-cors
|