Seidazymov Adil
commited on
Commit
·
4fd964c
1
Parent(s):
884f987
Final 1.10
Browse files
app.py
CHANGED
|
@@ -78,17 +78,27 @@ def detect_toxic_local(text_whisper):
|
|
| 78 |
return None
|
| 79 |
|
| 80 |
|
| 81 |
-
def assessment(file_path):
|
| 82 |
language = detect_language(file_path) or "unknown"
|
| 83 |
result_text = request_gradio(file_path, language) or ""
|
| 84 |
result_emotion = detect_emotion(file_path) or "unknown"
|
| 85 |
result_toxic = detect_toxic_local(result_text) or False
|
| 86 |
-
return json.dumps({"
|
| 87 |
|
|
|
|
| 88 |
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
return None
|
| 79 |
|
| 80 |
|
| 81 |
+
def assessment(file_path, language):
|
| 82 |
language = detect_language(file_path) or "unknown"
|
| 83 |
result_text = request_gradio(file_path, language) or ""
|
| 84 |
result_emotion = detect_emotion(file_path) or "unknown"
|
| 85 |
result_toxic = detect_toxic_local(result_text) or False
|
| 86 |
+
return json.dumps({"transcription": result_text, "emotion": result_emotion, "toxic": result_toxic,})
|
| 87 |
|
| 88 |
+
demo = gr.Blocks()
|
| 89 |
|
| 90 |
+
with demo:
|
| 91 |
+
with gr.Tabs():
|
| 92 |
+
with gr.TabItem('Language Detection'):
|
| 93 |
+
language_detection_interface = gr.Interface(
|
| 94 |
+
fn=detect_language,
|
| 95 |
+
inputs=gr.Audio(sources=["upload"], type="filepath"),
|
| 96 |
+
outputs='text',
|
| 97 |
+
)
|
| 98 |
+
with gr.TabItem('Toxic & Emotion Detection'):
|
| 99 |
+
toxic_and_emotion_detection_interface = gr.Interface(
|
| 100 |
+
fn=assessment,
|
| 101 |
+
inputs=[gr.Audio(sources=["upload"], type="filepath"), gr.Textbox(label="Language")],
|
| 102 |
+
outputs='json',
|
| 103 |
+
)
|
| 104 |
+
demo.launch()
|