Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -90,10 +90,6 @@ if uploaded_file is not None:
|
|
| 90 |
# Create a PowerPoint presentation
|
| 91 |
prs = Presentation()
|
| 92 |
|
| 93 |
-
# Set the desired width and height for the image
|
| 94 |
-
image_width = Inches(5)
|
| 95 |
-
image_height = Inches(5)
|
| 96 |
-
|
| 97 |
for paragraph in paragraphs:
|
| 98 |
summary = summarizer(paragraph, max_length=(len(paragraph) / 2), min_length=10, do_sample=False)
|
| 99 |
summary_text = add_line_breaks_to_summary(summary[0]['summary_text'], 80)
|
|
@@ -109,11 +105,16 @@ if uploaded_file is not None:
|
|
| 109 |
# Create a slide
|
| 110 |
slide = prs.slides.add_slide(prs.slide_layouts[5])
|
| 111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
# Add the paragraph to the slide at the top
|
| 113 |
left = Inches(1)
|
| 114 |
top = Inches(1)
|
| 115 |
width = Inches(8) # Adjust the width as needed
|
| 116 |
-
height = Inches(
|
| 117 |
txBox = slide.shapes.add_textbox(left, top, width, height)
|
| 118 |
tf = txBox.text_frame
|
| 119 |
p = tf.add_paragraph()
|
|
@@ -123,13 +124,6 @@ if uploaded_file is not None:
|
|
| 123 |
p.text = summary_text
|
| 124 |
p.space_after = Pt(0) # Adjust the spacing as needed
|
| 125 |
|
| 126 |
-
# Declare the image_top variable and set it to place the image at the bottom
|
| 127 |
-
image_left = (prs.slide_width - image_width) / 2
|
| 128 |
-
image_top = prs.slide_height - image_height - Inches(1) # Adjust the Inches(1) value as needed
|
| 129 |
-
|
| 130 |
-
# Add the image to the slide at the bottom
|
| 131 |
-
pic = slide.shapes.add_picture(temp_img_path, image_left, image_top, image_width, image_height)
|
| 132 |
-
|
| 133 |
i += 1
|
| 134 |
|
| 135 |
# Save the PowerPoint presentation
|
|
|
|
| 90 |
# Create a PowerPoint presentation
|
| 91 |
prs = Presentation()
|
| 92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
for paragraph in paragraphs:
|
| 94 |
summary = summarizer(paragraph, max_length=(len(paragraph) / 2), min_length=10, do_sample=False)
|
| 95 |
summary_text = add_line_breaks_to_summary(summary[0]['summary_text'], 80)
|
|
|
|
| 105 |
# Create a slide
|
| 106 |
slide = prs.slides.add_slide(prs.slide_layouts[5])
|
| 107 |
|
| 108 |
+
# Add the image to the slide at the bottom
|
| 109 |
+
left = (prs.slide_width - Inches(3)) / 2
|
| 110 |
+
top = prs.slide_height - Inches(3)
|
| 111 |
+
pic = slide.shapes.add_picture(temp_img_path, left, top, Inches(3), Inches(3))
|
| 112 |
+
|
| 113 |
# Add the paragraph to the slide at the top
|
| 114 |
left = Inches(1)
|
| 115 |
top = Inches(1)
|
| 116 |
width = Inches(8) # Adjust the width as needed
|
| 117 |
+
height = prs.slide_height - Inches(4) # Adjust the height as needed
|
| 118 |
txBox = slide.shapes.add_textbox(left, top, width, height)
|
| 119 |
tf = txBox.text_frame
|
| 120 |
p = tf.add_paragraph()
|
|
|
|
| 124 |
p.text = summary_text
|
| 125 |
p.space_after = Pt(0) # Adjust the spacing as needed
|
| 126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
i += 1
|
| 128 |
|
| 129 |
# Save the PowerPoint presentation
|