Update app.py
Browse files
app.py
CHANGED
@@ -19,8 +19,9 @@ talking_face = gr.Blocks.load(name="spaces/fffiloni/one-shot-talking-face", api_
|
|
19 |
|
20 |
def infer(audio, openai_api_key, progress=gr.Progress()):
|
21 |
|
22 |
-
|
23 |
-
|
|
|
24 |
time.sleep(0.1)
|
25 |
|
26 |
whisper_result = whisper(audio, None, "translate", fn_index=0)
|
@@ -33,7 +34,13 @@ def infer(audio, openai_api_key, progress=gr.Progress()):
|
|
33 |
|
34 |
return gr.Textbox.update(value=whisper_result, visible=True), portrait_link, gr.Textbox.update(value=gpt_response[1], visible=True), gr.update(visible=True)
|
35 |
|
36 |
-
def try_api(message, openai_api_key):
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
try:
|
38 |
response = call_api(message, openai_api_key)
|
39 |
return response, "<span class='openai_clear'>no error</span>"
|
|
|
19 |
|
20 |
def infer(audio, openai_api_key, progress=gr.Progress()):
|
21 |
|
22 |
+
progress(0, desc="Starting...")
|
23 |
+
time.sleep(1)
|
24 |
+
for i in progress.tqdm(range(100)):
|
25 |
time.sleep(0.1)
|
26 |
|
27 |
whisper_result = whisper(audio, None, "translate", fn_index=0)
|
|
|
34 |
|
35 |
return gr.Textbox.update(value=whisper_result, visible=True), portrait_link, gr.Textbox.update(value=gpt_response[1], visible=True), gr.update(visible=True)
|
36 |
|
37 |
+
def try_api(message, openai_api_key, progress=gr.Progress()):
|
38 |
+
|
39 |
+
progress(0, desc="Try API...")
|
40 |
+
time.sleep(1)
|
41 |
+
for i in progress.tqdm(range(100)):
|
42 |
+
time.sleep(0.1)
|
43 |
+
|
44 |
try:
|
45 |
response = call_api(message, openai_api_key)
|
46 |
return response, "<span class='openai_clear'>no error</span>"
|