update api
Browse files
api.py
CHANGED
|
@@ -7,14 +7,13 @@ import fairseq
|
|
| 7 |
from fastapi import FastAPI, HTTPException
|
| 8 |
from fastapi.responses import FileResponse
|
| 9 |
from pydantic import BaseModel
|
| 10 |
-
from
|
| 11 |
-
from configs.config import Config
|
| 12 |
from uuid import uuid4
|
| 13 |
import requests
|
| 14 |
|
| 15 |
app = FastAPI()
|
| 16 |
|
| 17 |
-
|
| 18 |
{
|
| 19 |
"name": "zeta",
|
| 20 |
"label": "Zeta",
|
|
@@ -76,7 +75,7 @@ def limit_tts_files(output_dir, max_files=10):
|
|
| 76 |
@app.post("/tts")
|
| 77 |
async def tts_api(req: TTSRequest):
|
| 78 |
# Cari model berdasarkan name
|
| 79 |
-
model = next((m for m in
|
| 80 |
if not model:
|
| 81 |
raise HTTPException(status_code=404, detail=f"Model '{req.name}' not found.")
|
| 82 |
|
|
|
|
| 7 |
from fastapi import FastAPI, HTTPException
|
| 8 |
from fastapi.responses import FileResponse
|
| 9 |
from pydantic import BaseModel
|
| 10 |
+
from modules import models
|
|
|
|
| 11 |
from uuid import uuid4
|
| 12 |
import requests
|
| 13 |
|
| 14 |
app = FastAPI()
|
| 15 |
|
| 16 |
+
path_models = [
|
| 17 |
{
|
| 18 |
"name": "zeta",
|
| 19 |
"label": "Zeta",
|
|
|
|
| 75 |
@app.post("/tts")
|
| 76 |
async def tts_api(req: TTSRequest):
|
| 77 |
# Cari model berdasarkan name
|
| 78 |
+
model = next((m for m in path_models if m["name"] == req.name), None)
|
| 79 |
if not model:
|
| 80 |
raise HTTPException(status_code=404, detail=f"Model '{req.name}' not found.")
|
| 81 |
|