storresbusquets commited on
Commit
374286c
1 Parent(s): 9a38a5b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -48,7 +48,9 @@ class GradioInference():
48
 
49
  label = self.classifier(results["text"])[0]["label"]
50
  wordcloud = WordCloud(width=800, height=400, background_color='white').generate(results["text"])
51
- return results["text"], transcription_summary[0]["summary_text"], keywords, label, wordcloud
 
 
52
 
53
  def populate_metadata(self, link):
54
  self.yt = YouTube(link)
@@ -78,8 +80,9 @@ class GradioInference():
78
 
79
  label = self.classifier(results["text"])[0]["label"]
80
  wordcloud = WordCloud(width=800, height=400, background_color='white').generate(results["text"])
 
81
 
82
- return results["text"], transcription_summary[0]["summary_text"], keywords, label, wordcloud
83
 
84
 
85
  gio = GradioInference()
@@ -117,11 +120,11 @@ with block as demo:
117
  label = gr.Label(label="Sentiment Analysis")
118
  with gr.Row().style(equal_height=True):
119
  # Display the Word Cloud
120
- wordcloud = gr.Image()
121
  with gr.Row().style(equal_height=True):
122
  clear = gr.ClearButton([link, title, img, text, summary, keywords, label], scale=1)
123
  btn = gr.Button("Get video insights", variant='primary', scale=1)
124
- btn.click(gio, inputs=[link, lang, size], outputs=[text, summary, keywords, label, wordcloud])
125
  link.change(gio.populate_metadata, inputs=[link], outputs=[img, title])
126
 
127
  with gr.Tab("From Audio file"):
 
48
 
49
  label = self.classifier(results["text"])[0]["label"]
50
  wordcloud = WordCloud(width=800, height=400, background_color='white').generate(results["text"])
51
+ wordcloud_image = wordcloud.to_image()
52
+
53
+ return results["text"], transcription_summary[0]["summary_text"], keywords, label, wordcloud_image
54
 
55
  def populate_metadata(self, link):
56
  self.yt = YouTube(link)
 
80
 
81
  label = self.classifier(results["text"])[0]["label"]
82
  wordcloud = WordCloud(width=800, height=400, background_color='white').generate(results["text"])
83
+ wordcloud_image = wordcloud.to_image()
84
 
85
+ return results["text"], transcription_summary[0]["summary_text"], keywords, label, wordcloud_image
86
 
87
 
88
  gio = GradioInference()
 
120
  label = gr.Label(label="Sentiment Analysis")
121
  with gr.Row().style(equal_height=True):
122
  # Display the Word Cloud
123
+ wordcloud_image = gr.Image()
124
  with gr.Row().style(equal_height=True):
125
  clear = gr.ClearButton([link, title, img, text, summary, keywords, label], scale=1)
126
  btn = gr.Button("Get video insights", variant='primary', scale=1)
127
+ btn.click(gio, inputs=[link, lang, size], outputs=[text, summary, keywords, label, wordcloud_image])
128
  link.change(gio.populate_metadata, inputs=[link], outputs=[img, title])
129
 
130
  with gr.Tab("From Audio file"):