Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,8 +29,8 @@ class_options = {
|
|
| 29 |
}
|
| 30 |
|
| 31 |
pipe = pipeline("automatic-speech-recognition", model="openai/whisper-large")
|
| 32 |
-
|
| 33 |
-
|
| 34 |
|
| 35 |
def slider_logic(slider):
|
| 36 |
threshold = 0
|
|
@@ -54,7 +54,7 @@ def classify_toxicity(audio_file, selected_sounds, slider):
|
|
| 54 |
# transcribed_text = pipe(audio_file)["text"]
|
| 55 |
|
| 56 |
threshold = slider_logic(slider)
|
| 57 |
-
model = whisper.load_model("large")
|
| 58 |
# model = model_cache[model_name]
|
| 59 |
# class_names = classify_anxiety.split(",")
|
| 60 |
classify_anxiety = "misophonia"
|
|
@@ -66,7 +66,7 @@ def classify_toxicity(audio_file, selected_sounds, slider):
|
|
| 66 |
class_names = class_str.split(",")
|
| 67 |
print("class names ", class_names, "classify_anxiety ", classify_anxiety)
|
| 68 |
|
| 69 |
-
tokenizer = get_tokenizer("large")
|
| 70 |
# tokenizer= WhisperTokenizer.from_pretrained("openai/whisper-large")
|
| 71 |
|
| 72 |
internal_lm_average_logprobs = classify.calculate_internal_lm_average_logprobs(
|
|
@@ -99,7 +99,7 @@ def classify_toxicity(audio_file, selected_sounds, slider):
|
|
| 99 |
highest_float = float(highest_score)
|
| 100 |
|
| 101 |
if highest_score is not None and highest_float > threshold:
|
| 102 |
-
affirm = "Threshold Exceeded"
|
| 103 |
else:
|
| 104 |
affirm = " "
|
| 105 |
|
|
|
|
| 29 |
}
|
| 30 |
|
| 31 |
pipe = pipeline("automatic-speech-recognition", model="openai/whisper-large")
|
| 32 |
+
model = whisper.load_model("large")
|
| 33 |
+
tokenizer = get_tokenizer("large")
|
| 34 |
|
| 35 |
def slider_logic(slider):
|
| 36 |
threshold = 0
|
|
|
|
| 54 |
# transcribed_text = pipe(audio_file)["text"]
|
| 55 |
|
| 56 |
threshold = slider_logic(slider)
|
| 57 |
+
# MODEL LINE model = whisper.load_model("large")
|
| 58 |
# model = model_cache[model_name]
|
| 59 |
# class_names = classify_anxiety.split(",")
|
| 60 |
classify_anxiety = "misophonia"
|
|
|
|
| 66 |
class_names = class_str.split(",")
|
| 67 |
print("class names ", class_names, "classify_anxiety ", classify_anxiety)
|
| 68 |
|
| 69 |
+
# TOKENIZER LINE tokenizer = get_tokenizer("large")
|
| 70 |
# tokenizer= WhisperTokenizer.from_pretrained("openai/whisper-large")
|
| 71 |
|
| 72 |
internal_lm_average_logprobs = classify.calculate_internal_lm_average_logprobs(
|
|
|
|
| 99 |
highest_float = float(highest_score)
|
| 100 |
|
| 101 |
if highest_score is not None and highest_float > threshold:
|
| 102 |
+
affirm = "Threshold Exceeded, initiate intervention"
|
| 103 |
else:
|
| 104 |
affirm = " "
|
| 105 |
|