Spaces:
Runtime error
Runtime error
storresbusquets
commited on
Commit
Β·
bba2975
1
Parent(s):
5cfe812
Update app.py
Browse files
app.py
CHANGED
@@ -73,7 +73,7 @@ class GradioInference:
|
|
73 |
# Transcribe the audio extracted from pytube
|
74 |
results = self.loaded_model.transcribe(path, language=lang)
|
75 |
|
76 |
-
progress(0.
|
77 |
# Perform summarization on the transcription
|
78 |
transcription_summary = self.summarizer(
|
79 |
results["text"], max_length=150, min_length=30, do_sample=False
|
@@ -117,7 +117,7 @@ class GradioInference:
|
|
117 |
predicted = self.keyword_tokenizer.decode(output[0], skip_special_tokens=True)
|
118 |
keywords = [x.strip() for x in predicted.split(",") if x.strip()]
|
119 |
|
120 |
-
progress(0.
|
121 |
# Sentiment label
|
122 |
label = self.classifier(summary)[0]["label"]
|
123 |
|
@@ -272,13 +272,13 @@ with block as demo:
|
|
272 |
<h1>YouTube <span style="color: red;">Insights</span> πΉ</h1>
|
273 |
</div>
|
274 |
<h4 style="margin-bottom: 10px; font-size: 94%">
|
275 |
-
Your AI-powered video analytics tool
|
276 |
</h4>
|
277 |
</div>
|
278 |
"""
|
279 |
)
|
280 |
with gr.Group():
|
281 |
-
with gr.Tab("From YouTube"):
|
282 |
with gr.Box():
|
283 |
with gr.Row().style(equal_height=True):
|
284 |
size = gr.Dropdown(
|
@@ -311,7 +311,7 @@ with block as demo:
|
|
311 |
clear = gr.ClearButton(
|
312 |
[link, title, img, text, summary, keywords, label, wordcloud_image], scale=1, rounded=True
|
313 |
)
|
314 |
-
btn = gr.Button("Get video insights", variant="primary", scale=1, rounded=True)
|
315 |
btn.click(
|
316 |
gio,
|
317 |
inputs=[link, lang, size],
|
@@ -319,7 +319,7 @@ with block as demo:
|
|
319 |
)
|
320 |
link.change(gio.populate_metadata, inputs=[link], outputs=[img, title])
|
321 |
|
322 |
-
with gr.Tab("From Audio file"):
|
323 |
with gr.Box():
|
324 |
with gr.Row().style(equal_height=True):
|
325 |
size = gr.Dropdown(
|
@@ -347,7 +347,7 @@ with block as demo:
|
|
347 |
with gr.Row().style(equal_height=True):
|
348 |
clear = gr.ClearButton([audio_file,text, summary, keywords, label, wordcloud_image], scale=1, rounded=True)
|
349 |
btn = gr.Button(
|
350 |
-
"Get video insights", variant="primary", scale=1, rounded=True
|
351 |
)
|
352 |
btn.click(
|
353 |
gio.from_audio_input,
|
|
|
73 |
# Transcribe the audio extracted from pytube
|
74 |
results = self.loaded_model.transcribe(path, language=lang)
|
75 |
|
76 |
+
progress(0.40, desc="Summarizing")
|
77 |
# Perform summarization on the transcription
|
78 |
transcription_summary = self.summarizer(
|
79 |
results["text"], max_length=150, min_length=30, do_sample=False
|
|
|
117 |
predicted = self.keyword_tokenizer.decode(output[0], skip_special_tokens=True)
|
118 |
keywords = [x.strip() for x in predicted.split(",") if x.strip()]
|
119 |
|
120 |
+
progress(0.80, desc="Extracting Sentiment")
|
121 |
# Sentiment label
|
122 |
label = self.classifier(summary)[0]["label"]
|
123 |
|
|
|
272 |
<h1>YouTube <span style="color: red;">Insights</span> πΉ</h1>
|
273 |
</div>
|
274 |
<h4 style="margin-bottom: 10px; font-size: 94%">
|
275 |
+
Your AI-powered video analytics tool β¨
|
276 |
</h4>
|
277 |
</div>
|
278 |
"""
|
279 |
)
|
280 |
with gr.Group():
|
281 |
+
with gr.Tab("From YouTube πΉ"):
|
282 |
with gr.Box():
|
283 |
with gr.Row().style(equal_height=True):
|
284 |
size = gr.Dropdown(
|
|
|
311 |
clear = gr.ClearButton(
|
312 |
[link, title, img, text, summary, keywords, label, wordcloud_image], scale=1, rounded=True
|
313 |
)
|
314 |
+
btn = gr.Button("Get video insights π", variant="primary", scale=1, rounded=True)
|
315 |
btn.click(
|
316 |
gio,
|
317 |
inputs=[link, lang, size],
|
|
|
319 |
)
|
320 |
link.change(gio.populate_metadata, inputs=[link], outputs=[img, title])
|
321 |
|
322 |
+
with gr.Tab("From Audio file ποΈ"):
|
323 |
with gr.Box():
|
324 |
with gr.Row().style(equal_height=True):
|
325 |
size = gr.Dropdown(
|
|
|
347 |
with gr.Row().style(equal_height=True):
|
348 |
clear = gr.ClearButton([audio_file,text, summary, keywords, label, wordcloud_image], scale=1, rounded=True)
|
349 |
btn = gr.Button(
|
350 |
+
"Get video insights π", variant="primary", scale=1, rounded=True
|
351 |
)
|
352 |
btn.click(
|
353 |
gio.from_audio_input,
|