Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,7 +15,6 @@ model_nlp = AutoModelForSequenceClassification.from_pretrained("cardiffnlp/twitt
|
|
| 15 |
model = whisper.load_model("small")
|
| 16 |
|
| 17 |
|
| 18 |
-
|
| 19 |
def inference_audio(audio):
|
| 20 |
audio = whisper.load_audio(audio)
|
| 21 |
audio = whisper.pad_or_trim(audio)
|
|
@@ -27,11 +26,10 @@ def inference_audio(audio):
|
|
| 27 |
options = whisper.DecodingOptions(fp16 = False)
|
| 28 |
result = whisper.decode(model, mel, options)
|
| 29 |
|
| 30 |
-
|
| 31 |
-
return result.text, gr.update(visible=True), gr.update(visible=True), gr.update(visible=True)
|
| 32 |
|
| 33 |
def inference_text(audio):
|
| 34 |
-
text
|
| 35 |
|
| 36 |
sentiment_task = pipeline("sentiment-analysis", model=model_nlp, tokenizer=tokenizer)
|
| 37 |
res=sentiment_task(text)[0]
|
|
@@ -50,6 +48,4 @@ app=gr.Interface(title="Sentiment Audio Analysis",fn=inference_text,inputs=[audi
|
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
-
app.launch()
|
| 54 |
-
|
| 55 |
-
|
|
|
|
| 15 |
model = whisper.load_model("small")
|
| 16 |
|
| 17 |
|
|
|
|
| 18 |
def inference_audio(audio):
|
| 19 |
audio = whisper.load_audio(audio)
|
| 20 |
audio = whisper.pad_or_trim(audio)
|
|
|
|
| 26 |
options = whisper.DecodingOptions(fp16 = False)
|
| 27 |
result = whisper.decode(model, mel, options)
|
| 28 |
|
| 29 |
+
return result.text
|
|
|
|
| 30 |
|
| 31 |
def inference_text(audio):
|
| 32 |
+
text =inference_audio(audio)
|
| 33 |
|
| 34 |
sentiment_task = pipeline("sentiment-analysis", model=model_nlp, tokenizer=tokenizer)
|
| 35 |
res=sentiment_task(text)[0]
|
|
|
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
+
app.launch()
|
|
|
|
|
|