DrishtiSharma commited on
Commit
9e51781
1 Parent(s): 74d759e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -23,14 +23,17 @@ def predict_and_ctc_lm_decode(input_file):
23
  transcribed_text = asr(speech, chunk_length_s=10, stride_length_s=1)["text"]
24
  pipe2 = pipeline("text-classification", model = "hackathon-pln-es/twitter_sexismo-finetuned-robertuito-exist2021")
25
  sexism_detection = pipe2(transcribed_text)[0]['label']
 
 
 
 
26
 
27
- return sexism_detection
28
 
29
  description = """ This is a Gradio demo for Spanish audio transcription-based Sexism detection. To use this, simply provide an audio input (audio recording or via microphone), which will subsequently be transcribed and classified as sexism/non-sexism pertaining to audio (transcription) with the help of pre-trained models.
30
 
31
 
32
 
33
- **NOTE regarding the predicted label: LABEL_0: "NON SEXISM" or LABEL_1: "SEXISM"**
34
 
35
 
36
 
@@ -38,7 +41,6 @@ Pre-trained Model used for Spanish ASR: [jonatasgrosman/wav2vec2-xls-r-1b-spanis
38
 
39
  Pre-trained Model used for Sexism Detection : [hackathon-pln-es/twitter_sexismo-finetuned-robertuito-exist2021](https://huggingface.co/hackathon-pln-es/twitter_sexismo-finetuned-robertuito-exist2021)
40
 
41
- Observation: To produce reliable results, the aforementioned pre-trained model for sexism detection requires some more training.
42
  """
43
 
44
 
 
23
  transcribed_text = asr(speech, chunk_length_s=10, stride_length_s=1)["text"]
24
  pipe2 = pipeline("text-classification", model = "hackathon-pln-es/twitter_sexismo-finetuned-robertuito-exist2021")
25
  sexism_detection = pipe2(transcribed_text)[0]['label']
26
+ if sexism_detection == "LABEL_0":
27
+ return "The input audio contains NON-SEXIST language"
28
+ else:
29
+ return "SEXIST LANGUAGE DETECTED"
30
 
 
31
 
32
  description = """ This is a Gradio demo for Spanish audio transcription-based Sexism detection. To use this, simply provide an audio input (audio recording or via microphone), which will subsequently be transcribed and classified as sexism/non-sexism pertaining to audio (transcription) with the help of pre-trained models.
33
 
34
 
35
 
36
+ **Note regarding the predicted label: LABEL_0: "NON SEXISM" or LABEL_1: "SEXISM"**
37
 
38
 
39
 
 
41
 
42
  Pre-trained Model used for Sexism Detection : [hackathon-pln-es/twitter_sexismo-finetuned-robertuito-exist2021](https://huggingface.co/hackathon-pln-es/twitter_sexismo-finetuned-robertuito-exist2021)
43
 
 
44
  """
45
 
46