jemole commited on
Commit
dfb1ee2
·
1 Parent(s): 55d7215

leave only the sentimiento tab

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -1,13 +1,13 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
- trans = pipeline("automatic-speech-recognition", model = "facebook/wav2vec2-large-xlsr-53-spanish")
5
  clasificador = pipeline("text-classification", model = "pysentimiento/robertuito-sentiment-analysis")
6
 
7
 
8
- def audio_a_texto(audio):
9
- text = trans(audio)["text"]
10
- return text
11
 
12
 
13
  def texto_a_sentimiento(text):
@@ -16,13 +16,13 @@ def texto_a_sentimiento(text):
16
  demo = gr.Blocks()
17
 
18
  with demo:
19
- gr.Markdown("Demo para la clase de Platzi sobre cómo usar los Blocks de Gradio.")
20
  with gr.Tabs():
21
- with gr.TabItem("Transcribe audio en español"):
22
- with gr.Row():
23
- audio = gr.Audio(source="microphone", type="filepath")
24
- transcripcion = gr.Textbox()
25
- b1 = gr.Button("Transcribe porfa")
26
 
27
  with gr.TabItem("Análisis de sentimiento en español"):
28
  with gr.Row():
@@ -30,7 +30,7 @@ with demo:
30
  label = gr.Label()
31
  b2 = gr.Button("Sentimiento porfa")
32
 
33
- b1.click(audio_a_texto, inputs=audio, outputs=transcripcion)
34
  b2.click(texto_a_sentimiento, inputs=texto, outputs=label)
35
 
36
  demo.launch()
 
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
+ #trans = pipeline("automatic-speech-recognition", model = "facebook/wav2vec2-large-xlsr-53-spanish")
5
  clasificador = pipeline("text-classification", model = "pysentimiento/robertuito-sentiment-analysis")
6
 
7
 
8
+ #def audio_a_texto(audio):
9
+ # text = trans(audio)["text"]
10
+ # return text
11
 
12
 
13
  def texto_a_sentimiento(text):
 
16
  demo = gr.Blocks()
17
 
18
  with demo:
19
+ gr.Markdown("Demo para el taller de FAIaS.")
20
  with gr.Tabs():
21
+ #with gr.TabItem("Transcribe audio en español"):
22
+ # with gr.Row():
23
+ # audio = gr.Audio(source="microphone", type="filepath")
24
+ # transcripcion = gr.Textbox()
25
+ # b1 = gr.Button("Transcribe porfa")
26
 
27
  with gr.TabItem("Análisis de sentimiento en español"):
28
  with gr.Row():
 
30
  label = gr.Label()
31
  b2 = gr.Button("Sentimiento porfa")
32
 
33
+ #b1.click(audio_a_texto, inputs=audio, outputs=transcripcion)
34
  b2.click(texto_a_sentimiento, inputs=texto, outputs=label)
35
 
36
  demo.launch()