Spaces:
Runtime error
Runtime error
Calvin commited on
Commit ·
b25b259
1
Parent(s): 2658ff7
change import
Browse files
app.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
from fastapi.responses import FileResponse
|
| 3 |
-
from transformers import AutoProcessor,
|
| 4 |
import torch
|
| 5 |
import soundfile as sf
|
| 6 |
import aiofiles
|
|
@@ -13,7 +13,7 @@ MODEL_NAME = "wibowo-id/vits-id"
|
|
| 13 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 14 |
|
| 15 |
processor = AutoProcessor.from_pretrained(MODEL_NAME)
|
| 16 |
-
model =
|
| 17 |
|
| 18 |
@app.post("/tts")
|
| 19 |
async def tts_api(payload: dict):
|
|
@@ -46,6 +46,4 @@ async def download_file(filename: str):
|
|
| 46 |
return {"error": "File not found"}
|
| 47 |
|
| 48 |
if __name__ == "__main__":
|
| 49 |
-
uvicorn.run("app:app", host="0.0.0.0", port=7860)
|
| 50 |
-
|
| 51 |
-
#recompile
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
from fastapi.responses import FileResponse
|
| 3 |
+
from transformers import AutoProcessor, VitsModel
|
| 4 |
import torch
|
| 5 |
import soundfile as sf
|
| 6 |
import aiofiles
|
|
|
|
| 13 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 14 |
|
| 15 |
processor = AutoProcessor.from_pretrained(MODEL_NAME)
|
| 16 |
+
model = VitsModel.from_pretrained(MODEL_NAME).to(device)
|
| 17 |
|
| 18 |
@app.post("/tts")
|
| 19 |
async def tts_api(payload: dict):
|
|
|
|
| 46 |
return {"error": "File not found"}
|
| 47 |
|
| 48 |
if __name__ == "__main__":
|
| 49 |
+
uvicorn.run("app:app", host="0.0.0.0", port=7860)
|
|
|
|
|
|