Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -107,7 +107,7 @@ def generate_itinerary(mood, location, budget, days):
|
|
| 107 |
|
| 108 |
itinerary_text = completion.choices[0].message.content
|
| 109 |
|
| 110 |
-
#
|
| 111 |
season_text = get_best_season(location_text)
|
| 112 |
|
| 113 |
# 📍 Map and image
|
|
@@ -132,7 +132,7 @@ def generate_itinerary(mood, location, budget, days):
|
|
| 132 |
def get_best_season(location):
|
| 133 |
"""AI-powered function to recommend the best season or general weather for any location."""
|
| 134 |
if not location.strip() or location.lower() == "any destination":
|
| 135 |
-
return "
|
| 136 |
|
| 137 |
prompt = (
|
| 138 |
f"Suggest the best season or time of year to visit {location} based on weather and tourism. "
|
|
@@ -179,10 +179,11 @@ def generate_pdf(itinerary_text):
|
|
| 179 |
doc = SimpleDocTemplate(temp_path, pagesize=letter,
|
| 180 |
rightMargin=40, leftMargin=40,
|
| 181 |
topMargin=40, bottomMargin=40)
|
|
|
|
| 182 |
|
| 183 |
styles = getSampleStyleSheet()
|
| 184 |
style = styles["Normal"]
|
| 185 |
-
style.fontName = "
|
| 186 |
style.fontSize = 13
|
| 187 |
style.leading = 18
|
| 188 |
|
|
|
|
| 107 |
|
| 108 |
itinerary_text = completion.choices[0].message.content
|
| 109 |
|
| 110 |
+
# Get general season/weather info
|
| 111 |
season_text = get_best_season(location_text)
|
| 112 |
|
| 113 |
# 📍 Map and image
|
|
|
|
| 132 |
def get_best_season(location):
|
| 133 |
"""AI-powered function to recommend the best season or general weather for any location."""
|
| 134 |
if not location.strip() or location.lower() == "any destination":
|
| 135 |
+
return " Best season info is available for specific locations only."
|
| 136 |
|
| 137 |
prompt = (
|
| 138 |
f"Suggest the best season or time of year to visit {location} based on weather and tourism. "
|
|
|
|
| 179 |
doc = SimpleDocTemplate(temp_path, pagesize=letter,
|
| 180 |
rightMargin=40, leftMargin=40,
|
| 181 |
topMargin=40, bottomMargin=40)
|
| 182 |
+
pdfmetrics.registerFont(TTFont('DejaVu', '/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf'))
|
| 183 |
|
| 184 |
styles = getSampleStyleSheet()
|
| 185 |
style = styles["Normal"]
|
| 186 |
+
style.fontName = "DejaVu"
|
| 187 |
style.fontSize = 13
|
| 188 |
style.leading = 18
|
| 189 |
|