GirishKiran commited on
Commit
7457cc5
·
1 Parent(s): d7d595f

Removed whisper

Browse files
Files changed (1) hide show
  1. app.py +0 -17
app.py CHANGED
@@ -183,7 +183,6 @@ from matplotlib.colors import LinearSegmentedColormap
183
  import scipy
184
  import scipy.special
185
  import pandas
186
- import whisper
187
 
188
  class SentimentAnalyser(object):
189
 
@@ -244,20 +243,6 @@ def draw_bar_plot(df_data, title='Sentiment Analysis', xlabel='p string', ylabel
244
  grid=True)
245
  return pic
246
 
247
- @add_method(SentimentAnalyser)
248
- def inference(audio):
249
- audio = whisper.load_audio(audio)
250
- audio = whisper.pad_or_trim(audio)
251
-
252
- mel = whisper.log_mel_spectrogram(audio).to(sentiment.whisper_model.device)
253
-
254
- _, probs = sentiment.whisper_model.detect_language(mel)
255
-
256
- options = whisper.DecodingOptions(fp16 = False)
257
- result = whisper.decode(sentiment.whisper_model, mel, options)
258
-
259
- print(result.text)
260
- return result.text
261
 
262
  @add_method(SentimentAnalyser)
263
  def predict_sentiment(input_text):
@@ -295,6 +280,4 @@ with gradio.Interface(fn=predict_sentiment,
295
  description=desc,
296
  examples=exp,
297
  article=arti) as demo:
298
- with gradio.Blocks() as block:
299
- whisper_button.click(inference, inputs=[whisper_audio], outputs=[input_text])
300
  demo.launch(debug=True)
 
183
  import scipy
184
  import scipy.special
185
  import pandas
 
186
 
187
  class SentimentAnalyser(object):
188
 
 
243
  grid=True)
244
  return pic
245
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
246
 
247
  @add_method(SentimentAnalyser)
248
  def predict_sentiment(input_text):
 
280
  description=desc,
281
  examples=exp,
282
  article=arti) as demo:
 
 
283
  demo.launch(debug=True)