Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,15 +2,15 @@ enhanced_accessibility = False #@param {type:"boolean"}
|
|
| 2 |
#@markdown ---
|
| 3 |
|
| 4 |
#@markdown #### Please select your language:
|
| 5 |
-
lang_select = "English" #@param ["English", "Spanish"]
|
| 6 |
-
if lang_select == "English":
|
| 7 |
-
|
| 8 |
-
elif lang_select == "Spanish":
|
| 9 |
-
|
| 10 |
-
else:
|
| 11 |
-
raise Exception("Language not supported.")
|
| 12 |
#@markdown ---
|
| 13 |
-
|
| 14 |
use_gpu = False #@param {type:"boolean"}
|
| 15 |
from fastapi import FastAPI
|
| 16 |
import json
|
|
@@ -27,13 +27,13 @@ import glob
|
|
| 27 |
import ipywidgets as widgets
|
| 28 |
from IPython.display import display, Audio, Markdown, clear_output
|
| 29 |
from piper_phonemize import phonemize_codepoints, phonemize_espeak, tashkeel_run
|
| 30 |
-
|
| 31 |
_LOGGER = logging.getLogger("piper_train.infer_onnx")
|
| 32 |
import os
|
| 33 |
-
if not os.path.exists("./content/piper/src/python/lng"):
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
|
| 38 |
import sys
|
| 39 |
#sys.path.append('/content/piper/notebooks')
|
|
@@ -75,7 +75,7 @@ def detect_onnx_models(path):
|
|
| 75 |
else:
|
| 76 |
return None
|
| 77 |
|
| 78 |
-
|
| 79 |
def app():
|
| 80 |
"""Main entry point"""
|
| 81 |
sys.path.append('./content/piper/src/python')
|
|
@@ -413,13 +413,13 @@ def transform(input_data):
|
|
| 413 |
|
| 414 |
return magnitude, phase
|
| 415 |
|
| 416 |
-
if __name__ == "__main__":
|
| 417 |
-
|
| 418 |
|
| 419 |
# Create an instance of the FastAPI class
|
| 420 |
#app = main()
|
| 421 |
|
| 422 |
# Define a route for the root endpoint
|
| 423 |
-
|
| 424 |
#def read_root():
|
| 425 |
# return {"message": "Hello, World!"}
|
|
|
|
| 2 |
#@markdown ---
|
| 3 |
|
| 4 |
#@markdown #### Please select your language:
|
| 5 |
+
#lang_select = "English" #@param ["English", "Spanish"]
|
| 6 |
+
#if lang_select == "English":
|
| 7 |
+
# lang = "en"
|
| 8 |
+
#elif lang_select == "Spanish":
|
| 9 |
+
# lang = "es"
|
| 10 |
+
#else:
|
| 11 |
+
# raise Exception("Language not supported.")
|
| 12 |
#@markdown ---
|
| 13 |
+
lang = "en"
|
| 14 |
use_gpu = False #@param {type:"boolean"}
|
| 15 |
from fastapi import FastAPI
|
| 16 |
import json
|
|
|
|
| 27 |
import ipywidgets as widgets
|
| 28 |
from IPython.display import display, Audio, Markdown, clear_output
|
| 29 |
from piper_phonemize import phonemize_codepoints, phonemize_espeak, tashkeel_run
|
| 30 |
+
app = FastAPI()
|
| 31 |
_LOGGER = logging.getLogger("piper_train.infer_onnx")
|
| 32 |
import os
|
| 33 |
+
#if not os.path.exists("./content/piper/src/python/lng"):
|
| 34 |
+
# import subprocess
|
| 35 |
+
# command = "cp -r ./content/piper/notebooks/lng ./content/piper/src/python/lng"
|
| 36 |
+
# subprocess.run(command, shell=True)
|
| 37 |
|
| 38 |
import sys
|
| 39 |
#sys.path.append('/content/piper/notebooks')
|
|
|
|
| 75 |
else:
|
| 76 |
return None
|
| 77 |
|
| 78 |
+
@app.get("/")
|
| 79 |
def app():
|
| 80 |
"""Main entry point"""
|
| 81 |
sys.path.append('./content/piper/src/python')
|
|
|
|
| 413 |
|
| 414 |
return magnitude, phase
|
| 415 |
|
| 416 |
+
#if __name__ == "__main__":
|
| 417 |
+
# app()
|
| 418 |
|
| 419 |
# Create an instance of the FastAPI class
|
| 420 |
#app = main()
|
| 421 |
|
| 422 |
# Define a route for the root endpoint
|
| 423 |
+
|
| 424 |
#def read_root():
|
| 425 |
# return {"message": "Hello, World!"}
|