Seidazymov Adil commited on
Commit ·
4fd964c
1
Parent(s): 884f987
Final 1.10
Browse files77 unmodified lines787980818283848586878889909192939477 unmodified linesreturn Nonedef assessment(file_path):language = detect_language(file_path) or "unknown"result_text = request_gradio(file_path, language) or ""result_emotion = detect_emotion(file_path) or "unknown"result_toxic = detect_toxic_local(result_text) or Falsereturn json.dumps({"language": language, "transcription": result_text, "emotion": result_emotion, "toxic": result_toxic,})gradio_app = gr.Interface(fn=assessment,inputs=gr.Audio(sources=["upload"], type="filepath"),outputs="json")gradio_app.launch()77 unmodified lines7879808182838485868788899091929394959697989910010110210310477 unmodified linesreturn Nonedef assessment(file_path, language):language = detect_language(file_path) or "unknown"result_text = request_gradio(file_path, language) or ""result_emotion = detect_emotion(file_path) or "unknown"result_toxic = detect_toxic_local(result_text) or Falsereturn json.dumps({"transcription": result_text, "emotion": result_emotion, "toxic": result_toxic,})demo = gr.Blocks()with demo:with gr.Tabs():with gr.TabItem('Language Detection'):language_detection_interface = gr.Interface(fn=detect_language,inputs=gr.Audio(sources=["upload"], type="filepath"),outputs='text',)with gr.TabItem('Toxic & Emotion Detection'):toxic_and_emotion_detection_interface = gr.Interface(fn=assessment,inputs=[gr.Audio(sources=["upload"], type="filepath"), gr.Textbox(label="Language")],outputs='json',)demo.launch()
app.py+18-8