Create a streamlit application to find nearest restaurants using Google map
To upload files, please first save the app
import streamlit as st
import pandas as pd
st.set_page_config(page_title="Restaurant Finder", layout="wide")
st.title("🍽️ Restaurant Finder")
# Get user location
col1, col2 = st.columns(2)
with col1:
latitude = st.number_input("Your Latitude", value=37.7749, format="%.4f")
with col2:
longitude = st.number_input("Your Longitude", value=-122.4194, format="%.4f")
# Create sample restaurant data
data = {
'name': ['Pizza Place', 'Burger Joint', 'Sushi Bar', 'Italian Restaurant', 'Mexican Grill'],
'lat': [37.7755, 37.7746, 37.7751, 37.7742, 37.7758],
'lon': [-122.4188, -122.4199, -122.4185, -122.4191, -122.4203],
'rating': [4.5, 4.2, 4.8, 4.4, 4.3],
'cuisine': ['Pizza', 'American', 'Japanese', 'Italian', 'Mexican']
}
df = pd.DataFrame(data)
# Display the map with restaurants
st.subheader("📍 Nearby Restaurants")
st.map(df, latitude="lat", longitude="lon", size=20)
# Display restaurant details
st.subheader("📋 Restaurant Details")
st.dataframe(
df[["name", "cuisine", "rating"]],
hide_index=True,
column_config={
"name": "Restaurant Name",
"cuisine": "Cuisine Type",
"rating": st.column_config.NumberColumn(
"Rating",
help="Restaurant rating out of 5",
min_value=0,
max_value=5,
format="%.1f ⭐"
),
}
)
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?