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

Update app.py

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