Spaces:
Runtime error
Runtime error
Commit
·
0e5871d
1
Parent(s):
62261eb
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,19 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
|
|
|
| 3 |
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
|
| 4 |
+
pipe = pipeline(model="hackathon-pln-es/wav2vec2-base-finetuned-sentiment-mesd")
|
| 5 |
|
| 6 |
+
def classify_sentiment(audio):
|
| 7 |
+
sentiment_classifier = pipe(audio)
|
| 8 |
+
return sentiment_classifier
|
| 9 |
|
| 10 |
+
|
| 11 |
+
input_audio = gr.inputs.Audio(source="microphone", type="filepath", optional=True, label="Please record your voice")
|
| 12 |
+
label = gr.outputs.Label(num_top_classes=5)
|
| 13 |
+
|
| 14 |
+
gr.Interface(
|
| 15 |
+
fn = classify_sentiment,
|
| 16 |
+
inputs = input_audio,
|
| 17 |
+
outputs = label,
|
| 18 |
+
examples=[["images/cheetah1.jpg"], ["images/lion.jpg"]],
|
| 19 |
+
theme="grass").launch()
|