csukuangfj commited on
Commit
a5fe75c
·
1 Parent(s): a917486

handle long texts

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -128,10 +128,12 @@ def build_html_output(s: str, style: str = "result_item_success"):
128
 
129
  def process(language: str, repo_id: str, text: str, sid: str, speed: float):
130
  if len(text) > 1000:
131
- raise ValueError(
132
  "To ensure this space is responsive, please use short text for testing\n"
133
- "You can run sherpa-onnx locally to process long texts."
134
  )
 
 
135
  MyPrint(f"Input text: {text}. sid: {sid}, speed: {speed}")
136
  sid = int(sid)
137
  tts = get_pretrained_model(repo_id, speed)
 
128
 
129
  def process(language: str, repo_id: str, text: str, sid: str, speed: float):
130
  if len(text) > 1000:
131
+ info = (
132
  "To ensure this space is responsive, please use short text for testing\n"
133
+ + "You can run sherpa-onnx locally to process long texts."
134
  )
135
+ return "", build_html_output(info)
136
+
137
  MyPrint(f"Input text: {text}. sid: {sid}, speed: {speed}")
138
  sid = int(sid)
139
  tts = get_pretrained_model(repo_id, speed)