Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -30,6 +30,7 @@ openai.api_key = os.environ.get("OPENAI_KEY", None)
|
|
| 30 |
animals = [x.strip() for x in open('animals.txt').readlines()]
|
| 31 |
art_styles = [x.strip() for x in open('art_styles.txt').readlines()]
|
| 32 |
font_path = hf_hub_download("jonathang/fonts-ttf", "Vogue.ttf")
|
|
|
|
| 33 |
|
| 34 |
|
| 35 |
@cachetools.cached(cache={})
|
|
@@ -267,7 +268,7 @@ Ultrafine detail
|
|
| 267 |
draw = PIL.ImageDraw.Draw(image)
|
| 268 |
|
| 269 |
# Load a font
|
| 270 |
-
font = PIL.ImageFont.truetype(
|
| 271 |
|
| 272 |
# Draw text on the image
|
| 273 |
y_text = 5
|
|
@@ -276,8 +277,8 @@ Ultrafine detail
|
|
| 276 |
'Condition': weather_data['now']['Weather'],},
|
| 277 |
'hour': {'Temperature': weather_data['hour']['temperature'],
|
| 278 |
'Condition': weather_data['hour']['weather']},
|
| 279 |
-
'day': {'High': max(weather_data['day']['temperature']),
|
| 280 |
-
'Low': min(weather_data['day']['temperature']),
|
| 281 |
'Condition': weather_data['day']['weather'][0]},
|
| 282 |
}
|
| 283 |
|
|
|
|
| 30 |
animals = [x.strip() for x in open('animals.txt').readlines()]
|
| 31 |
art_styles = [x.strip() for x in open('art_styles.txt').readlines()]
|
| 32 |
font_path = hf_hub_download("jonathang/fonts-ttf", "Vogue.ttf")
|
| 33 |
+
other_font_path = hf_hub_download("ybelkada/fonts", "Arial.TTF")
|
| 34 |
|
| 35 |
|
| 36 |
@cachetools.cached(cache={})
|
|
|
|
| 268 |
draw = PIL.ImageDraw.Draw(image)
|
| 269 |
|
| 270 |
# Load a font
|
| 271 |
+
font = PIL.ImageFont.truetype(other_font_path, 12)
|
| 272 |
|
| 273 |
# Draw text on the image
|
| 274 |
y_text = 5
|
|
|
|
| 277 |
'Condition': weather_data['now']['Weather'],},
|
| 278 |
'hour': {'Temperature': weather_data['hour']['temperature'],
|
| 279 |
'Condition': weather_data['hour']['weather']},
|
| 280 |
+
'day': {'High': int(max(float(t) for t in weather_data['day']['temperature'])),
|
| 281 |
+
'Low': int(min(float(t) for t in weather_data['day']['temperature'])),
|
| 282 |
'Condition': weather_data['day']['weather'][0]},
|
| 283 |
}
|
| 284 |
|