Spaces:
Runtime error
Runtime error
Commit
·
da14581
1
Parent(s):
dc20cd0
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,8 @@ import gradio as gr
|
|
2 |
import whisper
|
3 |
from pytube import YouTube
|
4 |
from transformers import pipeline, T5Tokenizer, T5ForConditionalGeneration, AutoTokenizer, AutoModelForSeq2SeqLM
|
|
|
|
|
5 |
|
6 |
class GradioInference():
|
7 |
def __init__(self):
|
@@ -75,8 +77,9 @@ class GradioInference():
|
|
75 |
keywords = [x.strip() for x in predicted.split(',') if x.strip()]
|
76 |
|
77 |
label = self.classifier(results["text"])[0]["label"]
|
|
|
78 |
|
79 |
-
return results["text"], transcription_summary[0]["summary_text"], keywords, label
|
80 |
|
81 |
|
82 |
gio = GradioInference()
|
@@ -112,10 +115,13 @@ with block as demo:
|
|
112 |
summary = gr.Textbox(label="Summary", placeholder="Summary Output...", lines=5).style(show_copy_button=True, container=True)
|
113 |
keywords = gr.Textbox(label="Keywords", placeholder="Keywords Output...", lines=5).style(show_copy_button=True, container=True)
|
114 |
label = gr.Label(label="Sentiment Analysis")
|
|
|
|
|
|
|
115 |
with gr.Row().style(equal_height=True):
|
116 |
clear = gr.ClearButton([link, title, img, text, summary, keywords, label], scale=1)
|
117 |
btn = gr.Button("Get video insights", variant='primary', scale=1)
|
118 |
-
btn.click(gio, inputs=[link, lang, size], outputs=[text, summary, keywords, label])
|
119 |
link.change(gio.populate_metadata, inputs=[link], outputs=[img, title])
|
120 |
|
121 |
with gr.Tab("From Audio file"):
|
|
|
2 |
import whisper
|
3 |
from pytube import YouTube
|
4 |
from transformers import pipeline, T5Tokenizer, T5ForConditionalGeneration, AutoTokenizer, AutoModelForSeq2SeqLM
|
5 |
+
from wordcloud import WordCloud
|
6 |
+
import matplotlib.pyplot as plt
|
7 |
|
8 |
class GradioInference():
|
9 |
def __init__(self):
|
|
|
77 |
keywords = [x.strip() for x in predicted.split(',') if x.strip()]
|
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()
|
|
|
115 |
summary = gr.Textbox(label="Summary", placeholder="Summary Output...", lines=5).style(show_copy_button=True, container=True)
|
116 |
keywords = gr.Textbox(label="Keywords", placeholder="Keywords Output...", lines=5).style(show_copy_button=True, container=True)
|
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"):
|