Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,7 +9,7 @@ import io
|
|
| 9 |
from PIL import Image
|
| 10 |
from pptx import Presentation
|
| 11 |
from pptx.util import Inches, Pt
|
| 12 |
-
import tempfile
|
| 13 |
|
| 14 |
API_URL = "https://api-inference.huggingface.co/models/runwayml/stable-diffusion-v1-5"
|
| 15 |
headers = {"Authorization": "Bearer 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"}
|
|
@@ -105,12 +105,15 @@ if uploaded_file is not None:
|
|
| 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 = Inches(1)
|
| 110 |
-
top = Inches(
|
| 111 |
-
width = height = Inches(
|
| 112 |
pic = slide.shapes.add_picture(temp_img_path, left, top, width, height)
|
| 113 |
|
|
|
|
|
|
|
|
|
|
| 114 |
# Add the paragraph to the slide at the top
|
| 115 |
left = Inches(1)
|
| 116 |
top = Inches(1)
|
|
|
|
| 9 |
from PIL import Image
|
| 10 |
from pptx import Presentation
|
| 11 |
from pptx.util import Inches, Pt
|
| 12 |
+
import tempfile # Import tempfile module
|
| 13 |
|
| 14 |
API_URL = "https://api-inference.huggingface.co/models/runwayml/stable-diffusion-v1-5"
|
| 15 |
headers = {"Authorization": "Bearer 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"}
|
|
|
|
| 105 |
# Create a slide
|
| 106 |
slide = prs.slides.add_slide(prs.slide_layouts[5])
|
| 107 |
|
| 108 |
+
# Add the image to the slide, centered and at the bottom (1 inch from the bottom)
|
| 109 |
left = Inches(1)
|
| 110 |
+
top = Inches(5) # Adjust the top position for centering
|
| 111 |
+
width = height = Inches(5)
|
| 112 |
pic = slide.shapes.add_picture(temp_img_path, left, top, width, height)
|
| 113 |
|
| 114 |
+
# Center the image on the slide
|
| 115 |
+
pic.left = (prs.slide_width - pic.width) / 2
|
| 116 |
+
|
| 117 |
# Add the paragraph to the slide at the top
|
| 118 |
left = Inches(1)
|
| 119 |
top = Inches(1)
|