GirishKiran commited on
Commit
63eb83a
1 Parent(s): e29ed4c

Upload ./app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -201,9 +201,9 @@ class SentimentAnalyser(object):
201
  utility._ph()
202
  print(utility.fetch_system_info())
203
  utility._ph()
204
- print(utility.fetch_gpu_info())
205
  utility._ph()
206
- print(utility.fetch_host_ip())
207
  utility._ph()
208
  self._init_model()
209
  utility._login_hface()
@@ -211,7 +211,7 @@ class SentimentAnalyser(object):
211
 
212
  # initalise the model
213
  def _init_model(self):
214
- modelLink = "bhadresh-savani/distilbert-base-uncased-emotion"
215
  self.tokenizer = AutoTokenizer.from_pretrained(modelLink)
216
  self.model = AutoModelForSequenceClassification.from_pretrained(modelLink)
217
  self.whisper_model = whisper.load_model("small")
@@ -260,7 +260,7 @@ def inference(audio):
260
  return result.text
261
 
262
  @add_method(SentimentAnalyser)
263
- def predict_sentiment(input_text, input_audio = None, audio_text_btn = None):
264
  df_out = _predict_sentiment(input_text)
265
  max_column = df_out.loc[0].idxmax()
266
  max_value = df_out.loc[0].max()
@@ -276,7 +276,7 @@ whisper_audio = gradio.Audio(label="Audio Input",
276
  whisper_button = gradio.Button("Convert Audio to Text")
277
  input_text = gradio.Textbox(lines=1, label="Text Input", placeholder="type text here")
278
 
279
- in_box = [input_text,whisper_audio,whisper_button]
280
  out_box = [gradio.Plot(label="Sentiment Score:"),
281
  gradio.Textbox(lines=4, label="Raw JSON Response:")]
282
 
 
201
  utility._ph()
202
  print(utility.fetch_system_info())
203
  utility._ph()
204
+ # print(utility.fetch_gpu_info())
205
  utility._ph()
206
+ # print(utility.fetch_host_ip())
207
  utility._ph()
208
  self._init_model()
209
  utility._login_hface()
 
211
 
212
  # initalise the model
213
  def _init_model(self):
214
+ modelLink = "bhadresh-savani/distilbert-base-uncased-emotion" #"SamLowe/roberta-base-go_emotions"
215
  self.tokenizer = AutoTokenizer.from_pretrained(modelLink)
216
  self.model = AutoModelForSequenceClassification.from_pretrained(modelLink)
217
  self.whisper_model = whisper.load_model("small")
 
260
  return result.text
261
 
262
  @add_method(SentimentAnalyser)
263
+ def predict_sentiment(input_text):
264
  df_out = _predict_sentiment(input_text)
265
  max_column = df_out.loc[0].idxmax()
266
  max_value = df_out.loc[0].max()
 
276
  whisper_button = gradio.Button("Convert Audio to Text")
277
  input_text = gradio.Textbox(lines=1, label="Text Input", placeholder="type text here")
278
 
279
+ in_box = [input_text]
280
  out_box = [gradio.Plot(label="Sentiment Score:"),
281
  gradio.Textbox(lines=4, label="Raw JSON Response:")]
282