Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -21,16 +21,17 @@ def generate_summary(url):
|
|
21 |
|
22 |
def generate_summary_and_video(url):
|
23 |
summary = generate_summary(url)
|
|
|
24 |
try:
|
25 |
video_id = url.split("v=")[1].split("&")[0]
|
26 |
iframe = f'<iframe width="300" height="200" src="https://www.youtube.com/embed/{video_id}" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>'
|
27 |
-
return f"{iframe}
|
28 |
except IndexError:
|
29 |
return f"**Summary:**\n{summary}\n\nInvalid YouTube URL for video display."
|
30 |
|
31 |
css = """
|
32 |
.output-html {
|
33 |
-
font-size:
|
34 |
}
|
35 |
"""
|
36 |
|
@@ -39,7 +40,7 @@ demo = gr.Interface(
|
|
39 |
inputs=gr.Textbox(lines=2, placeholder="Enter URL..."),
|
40 |
outputs=gr.HTML(label="Results"),
|
41 |
title="Summarizer",
|
42 |
-
description="Enter the URL
|
43 |
css=css
|
44 |
)
|
45 |
|
|
|
21 |
|
22 |
def generate_summary_and_video(url):
|
23 |
summary = generate_summary(url)
|
24 |
+
summary_html = summary.replace("\n", "<br>")
|
25 |
try:
|
26 |
video_id = url.split("v=")[1].split("&")[0]
|
27 |
iframe = f'<iframe width="300" height="200" src="https://www.youtube.com/embed/{video_id}" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>'
|
28 |
+
return f"{iframe}<br><br>Những ý chính trong video:<br><br>{summary_html}"
|
29 |
except IndexError:
|
30 |
return f"**Summary:**\n{summary}\n\nInvalid YouTube URL for video display."
|
31 |
|
32 |
css = """
|
33 |
.output-html {
|
34 |
+
font-size: 40px;
|
35 |
}
|
36 |
"""
|
37 |
|
|
|
40 |
inputs=gr.Textbox(lines=2, placeholder="Enter URL..."),
|
41 |
outputs=gr.HTML(label="Results"),
|
42 |
title="Summarizer",
|
43 |
+
description="Enter the URL to display the YouTube video and summarize the content.",
|
44 |
css=css
|
45 |
)
|
46 |
|