Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,20 +28,6 @@ pipe = pipeline("automatic-speech-recognition")
|
|
| 28 |
def classify_toxicity(audio_file, text_input, classify_anxiety):
|
| 29 |
# Transcribe the audio file using Whisper ASR
|
| 30 |
if audio_file != None:
|
| 31 |
-
'''whisper_model = WhisperModel.from_pretrained("openai/whisper-base")
|
| 32 |
-
feature_extractor = AutoFeatureExtractor.from_pretrained("openai/whisper-base")
|
| 33 |
-
transcription_results = whisper_model.compute(uploaded=audio_file)
|
| 34 |
-
|
| 35 |
-
audio = whisper.load_audio(audio_file)
|
| 36 |
-
mel = whisper.log_mel_spectrogram(audio).to(model.device)
|
| 37 |
-
_, probs = model.detect_language(mel)
|
| 38 |
-
options = whisper.DecodingOptions(fp16 = False)
|
| 39 |
-
result = whisper.decode(model, mel, options)
|
| 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 ####
|
|
|
|
| 28 |
def classify_toxicity(audio_file, text_input, classify_anxiety):
|
| 29 |
# Transcribe the audio file using Whisper ASR
|
| 30 |
if audio_file != None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
transcribed_text = pipe(audio_file)["text"]
|
| 32 |
|
| 33 |
#### Emotion classification ####
|