Spaces:
Sleeping
Sleeping
Piyazon commited on
Commit ·
f45f9f2
1
Parent(s): dfabacf
added domain
Browse files
app.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
from fastapi import FastAPI, HTTPException
|
| 2 |
-
from fastapi.responses import StreamingResponse
|
| 3 |
from transformers import VitsModel, AutoTokenizer
|
| 4 |
import torch
|
| 5 |
import numpy as np
|
|
@@ -413,6 +413,7 @@ curl -X POST https://piyazon-tts-piyazon.hf.space/generate-tts \
|
|
| 413 |
"""
|
| 414 |
@app.post("/generate-tts")
|
| 415 |
async def generate_tts(input: TextInput):
|
|
|
|
| 416 |
try:
|
| 417 |
if input.lang=="ug":
|
| 418 |
model = model_ug
|
|
@@ -447,8 +448,21 @@ async def generate_tts(input: TextInput):
|
|
| 447 |
|
| 448 |
|
| 449 |
|
| 450 |
-
@app.get("/")
|
| 451 |
-
def greet_json():
|
| 452 |
-
|
| 453 |
-
|
| 454 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from fastapi import FastAPI, HTTPException
|
| 2 |
+
from fastapi.responses import StreamingResponse, HTMLResponse
|
| 3 |
from transformers import VitsModel, AutoTokenizer
|
| 4 |
import torch
|
| 5 |
import numpy as np
|
|
|
|
| 413 |
"""
|
| 414 |
@app.post("/generate-tts")
|
| 415 |
async def generate_tts(input: TextInput):
|
| 416 |
+
print(input.text)
|
| 417 |
try:
|
| 418 |
if input.lang=="ug":
|
| 419 |
model = model_ug
|
|
|
|
| 448 |
|
| 449 |
|
| 450 |
|
| 451 |
+
# @app.get("/")
|
| 452 |
+
# def greet_json():
|
| 453 |
+
# return {
|
| 454 |
+
# "Hello": "World!",
|
| 455 |
+
# }
|
| 456 |
+
|
| 457 |
+
@app.get("/", response_class=HTMLResponse)
|
| 458 |
+
def greet_html():
|
| 459 |
+
return """
|
| 460 |
+
<html>
|
| 461 |
+
<body>
|
| 462 |
+
<h1>
|
| 463 |
+
URL:
|
| 464 |
+
<a href="https://translate.piyazon.top">https://translate.piyazon.top</a>
|
| 465 |
+
</h1>
|
| 466 |
+
</body>
|
| 467 |
+
</html>
|
| 468 |
+
"""
|