Flo161 commited on
Commit
77ec81d
·
1 Parent(s): 4afa594

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
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 (resized to 500x500 pixels)
109
  left = Inches(1)
110
- top = Inches(2)
111
- width = height = Inches(3)
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)