Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,6 +22,7 @@ emotion_dict = {
|
|
| 22 |
'neu': 'Neutral'
|
| 23 |
}
|
| 24 |
|
|
|
|
| 25 |
|
| 26 |
# Create a Gradio interface with audio file and text inputs
|
| 27 |
def classify_toxicity(audio_file, text_input, classify_anxiety):
|
|
@@ -39,8 +40,9 @@ def classify_toxicity(audio_file, text_input, classify_anxiety):
|
|
| 39 |
# Extract the transcribed text
|
| 40 |
# transcribed_text = transcription_results["transcription"]
|
| 41 |
'''
|
| 42 |
-
model = whisper.load_model("base")
|
| 43 |
-
transcribed_text = model.transcribe(audio_file)
|
|
|
|
| 44 |
|
| 45 |
#### Emotion classification ####
|
| 46 |
emotion_classifier = foreign_class(source="speechbrain/emotion-recognition-wav2vec2-IEMOCAP", pymodule_file="custom_interface.py", classname="CustomEncoderWav2vec2Classifier")
|
|
|
|
| 22 |
'neu': 'Neutral'
|
| 23 |
}
|
| 24 |
|
| 25 |
+
pipe = pipeline("automatic-speech-recognition")
|
| 26 |
|
| 27 |
# Create a Gradio interface with audio file and text inputs
|
| 28 |
def classify_toxicity(audio_file, text_input, classify_anxiety):
|
|
|
|
| 40 |
# Extract the transcribed text
|
| 41 |
# transcribed_text = transcription_results["transcription"]
|
| 42 |
'''
|
| 43 |
+
# model = whisper.load_model("base")
|
| 44 |
+
# transcribed_text = model.transcribe(audio_file)
|
| 45 |
+
transcribed_text = pipe(audio_file)["text"]
|
| 46 |
|
| 47 |
#### Emotion classification ####
|
| 48 |
emotion_classifier = foreign_class(source="speechbrain/emotion-recognition-wav2vec2-IEMOCAP", pymodule_file="custom_interface.py", classname="CustomEncoderWav2vec2Classifier")
|