Spaces:
Running
on
Zero
Running
on
Zero
mrfakename
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -488,10 +488,12 @@ def synthandreturn(text):
|
|
488 |
mdl1, mdl2 = random.sample(list(AVAILABLE_MODELS.keys()), 2)
|
489 |
log_text(text)
|
490 |
print("[debug] Using", mdl1, mdl2)
|
491 |
-
def predict_and_update_result(text, model,
|
492 |
result = router.predict(text, AVAILABLE_MODELS[model], api_name="/synthesize")
|
493 |
-
|
494 |
-
|
|
|
|
|
495 |
thread1.start()
|
496 |
thread2.start()
|
497 |
thread1.join()
|
@@ -502,8 +504,8 @@ def synthandreturn(text):
|
|
502 |
gr.update(visible=True), # r2
|
503 |
mdl1, # model1
|
504 |
mdl2, # model2
|
505 |
-
gr.update(visible=True, value=
|
506 |
-
gr.update(visible=True, value=
|
507 |
gr.update(visible=True, interactive=True),
|
508 |
gr.update(visible=True, interactive=True),
|
509 |
gr.update(visible=False),
|
|
|
488 |
mdl1, mdl2 = random.sample(list(AVAILABLE_MODELS.keys()), 2)
|
489 |
log_text(text)
|
490 |
print("[debug] Using", mdl1, mdl2)
|
491 |
+
def predict_and_update_result(text, model, result_storage):
|
492 |
result = router.predict(text, AVAILABLE_MODELS[model], api_name="/synthesize")
|
493 |
+
result_storage[model] = result
|
494 |
+
results = {}
|
495 |
+
thread1 = threading.Thread(target=predict_and_update_result, args=(text, mdl1, results))
|
496 |
+
thread2 = threading.Thread(target=predict_and_update_result, args=(text, mdl2, results))
|
497 |
thread1.start()
|
498 |
thread2.start()
|
499 |
thread1.join()
|
|
|
504 |
gr.update(visible=True), # r2
|
505 |
mdl1, # model1
|
506 |
mdl2, # model2
|
507 |
+
gr.update(visible=True, value=results[mdl1]), # aud1
|
508 |
+
gr.update(visible=True, value=results[mdl2]), # aud2
|
509 |
gr.update(visible=True, interactive=True),
|
510 |
gr.update(visible=True, interactive=True),
|
511 |
gr.update(visible=False),
|