biplab2008 commited on
Commit
b089b57
·
verified ·
1 Parent(s): 5e0e4a4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -13
app.py CHANGED
@@ -1,16 +1,31 @@
1
- import numpy as np
 
2
  import gradio as gr
3
 
4
- def sepia(input_img):
5
- sepia_filter = np.array([
6
- [0.393, 0.769, 0.189],
7
- [0.349, 0.686, 0.168],
8
- [0.272, 0.534, 0.131]
9
- ])
10
- sepia_img = input_img.dot(sepia_filter.T)
11
- sepia_img /= sepia_img.max()
12
-
13
- return 'conversion complete'
14
-
15
- demo = gr.Interface(sepia, gr.Image(), "text")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  demo.launch()
 
1
+ #from transformers import pipeline
2
+
3
  import gradio as gr
4
 
5
+ #asr = pipeline("automatic-speech-recognition", "facebook/wav2vec2-base-960h")
6
+ #classifier = pipeline("text-classification")
7
+
8
+
9
+ def speech_to_text():
10
+ text = 'running speech to text'
11
+ return text
12
+
13
+
14
+ def text_to_sentiment():
15
+ return 'running text to sentiment'
16
+
17
+
18
+ demo = gr.Blocks()
19
+
20
+ with demo:
21
+ audio_file = gr.File()
22
+ text = gr.Textbox()
23
+ label = gr.Label()
24
+
25
+ b1 = gr.Button("Recognize Speech")
26
+ b2 = gr.Button("Classify Sentiment")
27
+
28
+ b1.click(speech_to_text, inputs=audio_file, outputs=text)
29
+ b2.click(text_to_sentiment, inputs=text, outputs=label)
30
+
31
  demo.launch()