Spaces:
Build error
Build error
Commit
·
d9ec907
1
Parent(s):
02d1679
Add application file
Browse files- .gitignore +30 -0
- app.py +21 -0
.gitignore
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
__pycache__
|
| 3 |
+
venv
|
| 4 |
+
env
|
| 5 |
+
.env
|
| 6 |
+
.venv
|
| 7 |
+
.pytest_cache
|
| 8 |
+
.coverage
|
| 9 |
+
.idea
|
| 10 |
+
.vscode
|
| 11 |
+
lightning_logs
|
| 12 |
+
.ipynb_checkpoints
|
| 13 |
+
.ckpt
|
| 14 |
+
example.ckpt
|
| 15 |
+
.neptune
|
| 16 |
+
logs_for_plots
|
| 17 |
+
logs_for_heuristics
|
| 18 |
+
logs_for_graphs
|
| 19 |
+
logs_for_freedom_maps
|
| 20 |
+
logs_for_experiments
|
| 21 |
+
heuristic_tables
|
| 22 |
+
stats
|
| 23 |
+
videos
|
| 24 |
+
algs_RL/stasts
|
| 25 |
+
.DS_Store
|
| 26 |
+
saved_replays
|
| 27 |
+
my_folder
|
| 28 |
+
results
|
| 29 |
+
test-trainer
|
| 30 |
+
.gradio
|
app.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
+
import gradio as gr
|
| 3 |
+
asr = pipeline("automatic-speech-recognition", "facebook/wav2vec2-base-960h")
|
| 4 |
+
classifier = pipeline("text-classification")
|
| 5 |
+
|
| 6 |
+
def speech_to_text(speech):
|
| 7 |
+
text = asr(speech)["text"]
|
| 8 |
+
return text
|
| 9 |
+
|
| 10 |
+
def text_to_sentiment(text):
|
| 11 |
+
return classifier(text)[0]["label"]
|
| 12 |
+
|
| 13 |
+
demo = gr.Blocks()
|
| 14 |
+
with demo:
|
| 15 |
+
audio_file = gr.Audio(type="filepath")
|
| 16 |
+
text = gr.Textbox()
|
| 17 |
+
label = gr.Label()
|
| 18 |
+
b1 = gr.Button("Recognize Speech")
|
| 19 |
+
b1.click(speech_to_text, inputs=audio_file, outputs=text)
|
| 20 |
+
text.change(text_to_sentiment, inputs=text, outputs=label)
|
| 21 |
+
demo.launch()
|