mskov commited on
Commit
28ff844
1 Parent(s): b074e3e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -2,7 +2,10 @@ import evaluate
2
  from evaluate.utils import launch_gradio_widget
3
  import gradio as gr
4
  from transformers import AutoModelForSequenceClassification, pipeline, RobertaForSequenceClassification, RobertaTokenizer, AutoTokenizer
5
-
 
 
 
6
 
7
  # Define the list of available models
8
  available_models = {
@@ -20,7 +23,7 @@ def classify_toxicity(audio_file, text_file, selected_model):
20
  # Extract the transcribed text
21
  transcribed_text = transcription_results["transcription"]
22
  else:
23
- with open(text_file) as f:
24
  for line in f:
25
  transcribed_text.append(line)
26
 
 
2
  from evaluate.utils import launch_gradio_widget
3
  import gradio as gr
4
  from transformers import AutoModelForSequenceClassification, pipeline, RobertaForSequenceClassification, RobertaTokenizer, AutoTokenizer
5
+ import tempfile
6
+
7
+ tmp = tempfile.NamedTemporaryFile()
8
+
9
 
10
  # Define the list of available models
11
  available_models = {
 
23
  # Extract the transcribed text
24
  transcribed_text = transcription_results["transcription"]
25
  else:
26
+ with open(tmp.text_file) as f:
27
  for line in f:
28
  transcribed_text.append(line)
29