sergiolucero commited on
Commit
96bde30
1 Parent(s): 26cc76d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -6
app.py CHANGED
@@ -1,12 +1,15 @@
1
  import gradio as gr
2
  from pydub import AudioSegment
3
- from ailib import whisper_transcribe
4
  import pandas as pd
5
 
6
  def transcribe(audiofile):
7
  #audio = AudioSegment.from_file(audiofile)
8
  #open(filename, 'wb').write(audio)
9
- return whisper_transcribe(audiofile)
 
 
 
10
 
11
  def display_text(paciente):
12
  resumen_historial = df[df.paciente==paciente]['Resumen'].iloc[0]
@@ -21,25 +24,29 @@ pid_dict = dict(zip(df.paciente, df.pac_id))
21
  ################################################
22
  # gr.title("Demo CORFO")
23
 
24
-
25
  with gr.Blocks() as demo:
26
  with gr.Row():
27
  audemo = gr.Interface(
28
  transcribe,
29
  gr.Audio(sources=["microphone"], type="filepath"),
30
- "text",
31
  )
32
  with gr.Row():
33
  with gr.Column(scale=1):
34
  radio = gr.Radio(choices=pacientes,
35
  label="PACIENTE", value=pacientes[0], interactive=True)
36
  with gr.Column(scale=4):
37
- with gr.Row():
 
 
 
 
38
  with gr.Accordion('Resumen Historial'): # use radio?
39
  left_text = gr.Markdown()
40
  with gr.Accordion('Historial'):
41
  right_text = gr.Markdown()
42
 
43
- radio.change(display_text, inputs=radio, outputs=[left_text, right_text])
 
44
 
45
  demo.launch()
 
1
  import gradio as gr
2
  from pydub import AudioSegment
3
+ from ailib import whisper_transcribe, summarize
4
  import pandas as pd
5
 
6
  def transcribe(audiofile):
7
  #audio = AudioSegment.from_file(audiofile)
8
  #open(filename, 'wb').write(audio)
9
+ consulta = whisper_transcribe(audiofile)
10
+ resumen = summarize(consulta)
11
+ random = 'CHALLA!'
12
+ return consulta, resumen, random
13
 
14
  def display_text(paciente):
15
  resumen_historial = df[df.paciente==paciente]['Resumen'].iloc[0]
 
24
  ################################################
25
  # gr.title("Demo CORFO")
26
 
 
27
  with gr.Blocks() as demo:
28
  with gr.Row():
29
  audemo = gr.Interface(
30
  transcribe,
31
  gr.Audio(sources=["microphone"], type="filepath"),
32
+ ["text","text","text"] # was simply "text",
33
  )
34
  with gr.Row():
35
  with gr.Column(scale=1):
36
  radio = gr.Radio(choices=pacientes,
37
  label="PACIENTE", value=pacientes[0], interactive=True)
38
  with gr.Column(scale=4):
39
+ with gr.Row(): # historial+resumen
40
+ resumen_trans = gr.Markdown()
41
+ nueva_ficha = gr.Markdown()
42
+
43
+ with gr.Row(): # historial+resumen
44
  with gr.Accordion('Resumen Historial'): # use radio?
45
  left_text = gr.Markdown()
46
  with gr.Accordion('Historial'):
47
  right_text = gr.Markdown()
48
 
49
+ radio.change(display_text, inputs=radio,
50
+ outputs=[left_text, right_text])
51
 
52
  demo.launch()