Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -124,9 +124,9 @@ class Image:
|
|
124 |
return resp["data"]
|
125 |
|
126 |
|
127 |
-
def overlay_text_on_image(img, text, position, text_color=(255, 255, 255), box_color=(0, 0, 0, 128)):
|
128 |
# Convert the base64 string back to an image
|
129 |
-
if
|
130 |
img_bytes = base64.b64decode(img)
|
131 |
img = PIL.Image.open(BytesIO(img_bytes))
|
132 |
|
@@ -202,8 +202,8 @@ Do not include specific numbers.'''.replace('\n', ' '))
|
|
202 |
forecast = Weather(zip_code).get_info()
|
203 |
images, texts = [], []
|
204 |
for time, data in forecast.items():
|
205 |
-
img, txt =
|
206 |
-
images.append(img)
|
207 |
texts.append(txt)
|
208 |
return create_collage(*images), *texts
|
209 |
|
|
|
124 |
return resp["data"]
|
125 |
|
126 |
|
127 |
+
def overlay_text_on_image(img, text, position, text_color=(255, 255, 255), box_color=(0, 0, 0, 128), decode=False):
|
128 |
# Convert the base64 string back to an image
|
129 |
+
if decode:
|
130 |
img_bytes = base64.b64decode(img)
|
131 |
img = PIL.Image.open(BytesIO(img_bytes))
|
132 |
|
|
|
202 |
forecast = Weather(zip_code).get_info()
|
203 |
images, texts = [], []
|
204 |
for time, data in forecast.items():
|
205 |
+
img, txt = self.step_one_forecast(data, **kwargs)
|
206 |
+
images.append(overlay_text_on_image(img, time, 'top-right', decode=True)
|
207 |
texts.append(txt)
|
208 |
return create_collage(*images), *texts
|
209 |
|