Update app.py
Browse files
app.py
CHANGED
@@ -7,15 +7,15 @@ RUNPOD_API = os.environ.get("RUNPOD_API")
|
|
7 |
RUNPOD_ENDPOINT = os.environ.get("RUNPOD_ENDPOINT")
|
8 |
auth = [(os.environ.get("S2S_USER"), os.environ.get("S2S_PW")), (os.environ.get("POSOS_USER"), os.environ.get("POSOS_PW"))]
|
9 |
|
|
|
10 |
def welcome_user(request: gr.Request):
|
11 |
return f"Bienvenue {request.username}"
|
12 |
|
13 |
-
def doDebug(request):
|
14 |
debug = False
|
15 |
if request.username == os.environ.get("S2S_USER"):
|
16 |
debug = True
|
17 |
-
|
18 |
-
return debug
|
19 |
|
20 |
def process_transcribe(file):
|
21 |
audio_nparray = file[1]
|
@@ -32,7 +32,7 @@ def process_transcribe(file):
|
|
32 |
return raw_text,text_corrected
|
33 |
|
34 |
with gr.Blocks(theme=gr.themes.Default(primary_hue="blue")) as iface:
|
35 |
-
m = gr.Markdown()
|
36 |
iface.load(welcome_user, None, m)
|
37 |
with gr.Tab("Speech2text prescription"):
|
38 |
with gr.Row():
|
@@ -40,7 +40,8 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="blue")) as iface:
|
|
40 |
audio_file = gr.Audio(sources=["upload"], type="numpy", label="Audio")
|
41 |
submit_btn = gr.Button("Submit", variant="primary")
|
42 |
with gr.Column():
|
43 |
-
debug_transcript = gr.Textbox(label="Debug Transcription")
|
|
|
44 |
transcript = gr.Textbox(label="Transcription")
|
45 |
submit_btn.click(process_transcribe, inputs=[audio_file], outputs=[debug_transcript,transcript])
|
46 |
logout_button = gr.Button("Logout", link="/logout")
|
|
|
7 |
RUNPOD_ENDPOINT = os.environ.get("RUNPOD_ENDPOINT")
|
8 |
auth = [(os.environ.get("S2S_USER"), os.environ.get("S2S_PW")), (os.environ.get("POSOS_USER"), os.environ.get("POSOS_PW"))]
|
9 |
|
10 |
+
|
11 |
def welcome_user(request: gr.Request):
|
12 |
return f"Bienvenue {request.username}"
|
13 |
|
14 |
+
def doDebug(request: gr.Request):
|
15 |
debug = False
|
16 |
if request.username == os.environ.get("S2S_USER"):
|
17 |
debug = True
|
18 |
+
return gr.Textbox.update(label="Debug Transcription", visible=debug)
|
|
|
19 |
|
20 |
def process_transcribe(file):
|
21 |
audio_nparray = file[1]
|
|
|
32 |
return raw_text,text_corrected
|
33 |
|
34 |
with gr.Blocks(theme=gr.themes.Default(primary_hue="blue")) as iface:
|
35 |
+
m = gr.Markdown(value="bienvenue")
|
36 |
iface.load(welcome_user, None, m)
|
37 |
with gr.Tab("Speech2text prescription"):
|
38 |
with gr.Row():
|
|
|
40 |
audio_file = gr.Audio(sources=["upload"], type="numpy", label="Audio")
|
41 |
submit_btn = gr.Button("Submit", variant="primary")
|
42 |
with gr.Column():
|
43 |
+
debug_transcript = gr.Textbox(label="Debug Transcription", visible=False)
|
44 |
+
iface.load(doDebug, None, debug_transcript)
|
45 |
transcript = gr.Textbox(label="Transcription")
|
46 |
submit_btn.click(process_transcribe, inputs=[audio_file], outputs=[debug_transcript,transcript])
|
47 |
logout_button = gr.Button("Logout", link="/logout")
|