Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -57,6 +57,7 @@ def search(query):
|
|
57 |
"street_address": smalldf.street_address[r],
|
58 |
"city": smalldf.locality[r],
|
59 |
"country": smalldf.country[r],
|
|
|
60 |
"hotel_image":smalldf.hotel_image[r]
|
61 |
})
|
62 |
hlist.append(results.hotel_name[r])
|
@@ -68,7 +69,7 @@ import json
|
|
68 |
def display_hotel_info(query_json_str):
|
69 |
"""This app helps you find hotels based on your search query. Enter a city, location, hotel name or just type what you looking for ."""
|
70 |
try:
|
71 |
-
query_json = search(query_json_str)
|
72 |
hotel_infos = []
|
73 |
image_outputs = []
|
74 |
|
@@ -76,7 +77,6 @@ def display_hotel_info(query_json_str):
|
|
76 |
if not isinstance(hotel, dict):
|
77 |
raise ValueError("Expected hotel data to be a dictionary.")
|
78 |
|
79 |
-
|
80 |
name = hotel.get("name", "N/A")
|
81 |
score = hotel.get("score", 0.0)
|
82 |
rating = hotel.get("rating", "N/A")
|
@@ -84,9 +84,10 @@ def display_hotel_info(query_json_str):
|
|
84 |
street_address = hotel.get("street_address", "N/A")
|
85 |
city = hotel.get("city", "N/A")
|
86 |
country = hotel.get("country", "N/A")
|
|
|
87 |
hotel_image = hotel.get("hotel_image", None)
|
88 |
|
89 |
-
|
90 |
hotel_info = f"""
|
91 |
<div style="display: flex; align-items: center; margin-bottom: 20px;">
|
92 |
<div style="flex: 1;">
|
@@ -94,6 +95,7 @@ def display_hotel_info(query_json_str):
|
|
94 |
<p><strong>Rating:</strong> {rating}</p>
|
95 |
<p><strong>Review Count:</strong> {review_count}</p>
|
96 |
<p><strong>Address:</strong> {street_address}, {city}, {country}</p>
|
|
|
97 |
</div>
|
98 |
<div style="flex: 0 0 150px;">
|
99 |
<img src="{hotel_image}" alt="{name}" style="max-width: 150px; max-height: 150px; object-fit: cover;">
|
@@ -116,4 +118,3 @@ interface = gr.Interface(
|
|
116 |
)
|
117 |
|
118 |
interface.launch()
|
119 |
-
|
|
|
57 |
"street_address": smalldf.street_address[r],
|
58 |
"city": smalldf.locality[r],
|
59 |
"country": smalldf.country[r],
|
60 |
+
"hotel_description":smalldf.hotel_description[r],
|
61 |
"hotel_image":smalldf.hotel_image[r]
|
62 |
})
|
63 |
hlist.append(results.hotel_name[r])
|
|
|
69 |
def display_hotel_info(query_json_str):
|
70 |
"""This app helps you find hotels based on your search query. Enter a city, location, hotel name or just type what you looking for ."""
|
71 |
try:
|
72 |
+
query_json = search(query_json_str) # Assume this function returns a list of hotel data dictionaries
|
73 |
hotel_infos = []
|
74 |
image_outputs = []
|
75 |
|
|
|
77 |
if not isinstance(hotel, dict):
|
78 |
raise ValueError("Expected hotel data to be a dictionary.")
|
79 |
|
|
|
80 |
name = hotel.get("name", "N/A")
|
81 |
score = hotel.get("score", 0.0)
|
82 |
rating = hotel.get("rating", "N/A")
|
|
|
84 |
street_address = hotel.get("street_address", "N/A")
|
85 |
city = hotel.get("city", "N/A")
|
86 |
country = hotel.get("country", "N/A")
|
87 |
+
hotel_description=hotel.get("hotel_description","N/A")
|
88 |
hotel_image = hotel.get("hotel_image", None)
|
89 |
|
90 |
+
|
91 |
hotel_info = f"""
|
92 |
<div style="display: flex; align-items: center; margin-bottom: 20px;">
|
93 |
<div style="flex: 1;">
|
|
|
95 |
<p><strong>Rating:</strong> {rating}</p>
|
96 |
<p><strong>Review Count:</strong> {review_count}</p>
|
97 |
<p><strong>Address:</strong> {street_address}, {city}, {country}</p>
|
98 |
+
<p><strong>hotel_description:</strong> {hotel_description}</p>
|
99 |
</div>
|
100 |
<div style="flex: 0 0 150px;">
|
101 |
<img src="{hotel_image}" alt="{name}" style="max-width: 150px; max-height: 150px; object-fit: cover;">
|
|
|
118 |
)
|
119 |
|
120 |
interface.launch()
|
|