DrishtiSharma
commited on
Commit
•
81b2874
1
Parent(s):
1e4b89a
Update app.py
Browse files
app.py
CHANGED
@@ -28,8 +28,6 @@ def speech_to_text(input_file):
|
|
28 |
transcribed_text = asr(speech, chunk_length_s=15, stride_length_s=1)["text"]
|
29 |
return transcribed_text
|
30 |
|
31 |
-
|
32 |
-
|
33 |
#Defining a function for Harassment detection (text classification)
|
34 |
def harassment_detector(transcribed_text):
|
35 |
harassment_detection = classifier(transcribed_text)[0]["label"]
|
@@ -39,7 +37,7 @@ def harassment_detector(transcribed_text):
|
|
39 |
def asr_and_harassment_detection(input_file):
|
40 |
transcribed_text = speech_to_text(input_file)
|
41 |
harassment_detection = harassment_detector(transcribed_text)
|
42 |
-
return harassment_detection
|
43 |
|
44 |
|
45 |
inputs=[gr.inputs.Audio(source="microphone", type="filepath", label="Record your audio")]
|
|
|
28 |
transcribed_text = asr(speech, chunk_length_s=15, stride_length_s=1)["text"]
|
29 |
return transcribed_text
|
30 |
|
|
|
|
|
31 |
#Defining a function for Harassment detection (text classification)
|
32 |
def harassment_detector(transcribed_text):
|
33 |
harassment_detection = classifier(transcribed_text)[0]["label"]
|
|
|
37 |
def asr_and_harassment_detection(input_file):
|
38 |
transcribed_text = speech_to_text(input_file)
|
39 |
harassment_detection = harassment_detector(transcribed_text)
|
40 |
+
return f"Audio Transcription :{transcribed_text} {new_line} Audio content is: {harassment_detection}"
|
41 |
|
42 |
|
43 |
inputs=[gr.inputs.Audio(source="microphone", type="filepath", label="Record your audio")]
|