Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import pandas as pd
|
| 3 |
+
|
| 4 |
+
# Load dataset
|
| 5 |
+
@st.cache_data
|
| 6 |
+
def load_data():
|
| 7 |
+
return pd.read_csv("restaurants.csv")
|
| 8 |
+
|
| 9 |
+
data = load_data()
|
| 10 |
+
|
| 11 |
+
st.set_page_config(page_title="City Guide", layout="wide")
|
| 12 |
+
|
| 13 |
+
st.title("🍽️ City Restaurant Guide")
|
| 14 |
+
st.write("Find top restaurants in your city!")
|
| 15 |
+
|
| 16 |
+
city_input = st.text_input("Enter a city name (e.g., Lahore)", "").strip().title()
|
| 17 |
+
|
| 18 |
+
if city_input:
|
| 19 |
+
results = data[data['city'] == city_input]
|
| 20 |
+
|
| 21 |
+
if results.empty:
|
| 22 |
+
st.warning("No restaurants found for this city.")
|
| 23 |
+
else:
|
| 24 |
+
for _, row in results.iterrows():
|
| 25 |
+
with st.expander(row['name']):
|
| 26 |
+
st.markdown(f"**Address:** {row['address']}")
|
| 27 |
+
st.markdown(f"**Cuisine:** {row['cuisine']}")
|
| 28 |
+
st.markdown(f"**Contact:** {row['contact']}")
|
| 29 |
+
else:
|
| 30 |
+
st.info("Please enter a city name to see results.")
|