BlahBlah314 commited on
Commit
35313b9
·
verified ·
1 Parent(s): 9c3e4b7

Update app.py

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