Update app.py
Browse files
app.py
CHANGED
@@ -17,12 +17,7 @@ whisper = gr.Interface.load(name="spaces/sanchit-gandhi/whisper-large-v2")
|
|
17 |
tts = gr.Interface.load(name="spaces/Flux9665/IMS-Toucan")
|
18 |
talking_face = gr.Blocks.load(name="spaces/fffiloni/one-shot-talking-face", api_key=token)
|
19 |
|
20 |
-
def infer(audio, openai_api_key
|
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)
|
28 |
|
@@ -34,13 +29,8 @@ def infer(audio, openai_api_key, progress=gr.Progress()):
|
|
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
|
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>"
|
|
|
17 |
tts = gr.Interface.load(name="spaces/Flux9665/IMS-Toucan")
|
18 |
talking_face = gr.Blocks.load(name="spaces/fffiloni/one-shot-talking-face", api_key=token)
|
19 |
|
20 |
+
def infer(audio, openai_api_key):
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
whisper_result = whisper(audio, None, "translate", fn_index=0)
|
23 |
|
|
|
29 |
|
30 |
return gr.Textbox.update(value=whisper_result, visible=True), portrait_link, gr.Textbox.update(value=gpt_response[1], visible=True), gr.update(visible=True)
|
31 |
|
32 |
+
def try_api(message, openai_api_key):
|
33 |
|
|
|
|
|
|
|
|
|
|
|
34 |
try:
|
35 |
response = call_api(message, openai_api_key)
|
36 |
return response, "<span class='openai_clear'>no error</span>"
|