Update app.py
Browse files
app.py
CHANGED
@@ -10,6 +10,12 @@ auth = [(os.environ.get("S2S_USER"), os.environ.get("S2S_PW")), (os.environ.get(
|
|
10 |
def update_message(request: gr.Request):
|
11 |
return f"Welcome, {request.username}"
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
def process_transcribe(file):
|
14 |
print(file)
|
15 |
audio_nparray = file[1]
|
@@ -29,12 +35,17 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="blue")) as iface:
|
|
29 |
m = gr.Markdown()
|
30 |
iface.load(update_message, None, m)
|
31 |
logout_button = gr.Button("Logout", link="/logout")
|
|
|
32 |
with gr.Tab("Speech2text prescription"):
|
33 |
with gr.Row():
|
34 |
with gr.Column():
|
35 |
audio_file = gr.Audio(sources=["upload", "microphone"], type="numpy", label="Audio")
|
36 |
submit_btn = gr.Button("Submit", variant="primary")
|
37 |
with gr.Column():
|
38 |
-
|
|
|
|
|
|
|
|
|
39 |
submit_btn.click(process_transcribe, inputs=[audio_file], outputs=[raw_transcript])
|
40 |
iface.launch(auth=auth)
|
|
|
10 |
def update_message(request: gr.Request):
|
11 |
return f"Welcome, {request.username}"
|
12 |
|
13 |
+
def debug(request: gr.Request):
|
14 |
+
debug = False
|
15 |
+
if request.username == os.environ.get("S2S_USER"):
|
16 |
+
debug = True
|
17 |
+
return debug
|
18 |
+
|
19 |
def process_transcribe(file):
|
20 |
print(file)
|
21 |
audio_nparray = file[1]
|
|
|
35 |
m = gr.Markdown()
|
36 |
iface.load(update_message, None, m)
|
37 |
logout_button = gr.Button("Logout", link="/logout")
|
38 |
+
debug = debug()
|
39 |
with gr.Tab("Speech2text prescription"):
|
40 |
with gr.Row():
|
41 |
with gr.Column():
|
42 |
audio_file = gr.Audio(sources=["upload", "microphone"], type="numpy", label="Audio")
|
43 |
submit_btn = gr.Button("Submit", variant="primary")
|
44 |
with gr.Column():
|
45 |
+
if debug:
|
46 |
+
debug_transcript = gr.Textbox(label="Transcription Debug")
|
47 |
+
transcript = gr.Textbox(label="Transcription")
|
48 |
+
else:
|
49 |
+
transcript = gr.Textbox(label="Transcription")
|
50 |
submit_btn.click(process_transcribe, inputs=[audio_file], outputs=[raw_transcript])
|
51 |
iface.launch(auth=auth)
|