|
import streamlit as st |
|
import pandas as pd |
|
|
|
|
|
df = pd.read_excel('Book1.xlsx') |
|
|
|
|
|
df.columns = df.columns.str.strip() |
|
|
|
|
|
def clean_route(route): |
|
|
|
return route.replace("_x000D_", "").strip() |
|
|
|
|
|
def search_by_location(location): |
|
|
|
buses_with_location = df[df['Routes'].str.contains(location, case=False, na=False)] |
|
return buses_with_location |
|
|
|
|
|
def get_route_by_bus(bus_name): |
|
|
|
bus_route = df[df['Dhaka Local Buses'] == bus_name]['Routes'].values |
|
if len(bus_route) > 0: |
|
return clean_route(bus_route[0]) |
|
else: |
|
return "No route found for this bus." |
|
|
|
|
|
def main(): |
|
st.title("Dhaka Local 🚌 and 🏞 Finder") |
|
|
|
|
|
st.header("Search Bus Name") |
|
|
|
|
|
bus_name = st.selectbox( |
|
'Select a Bus Name from dropdown', |
|
['Select Bus Name from dropdown'] + df['Dhaka Local Buses'].tolist() |
|
) |
|
|
|
if bus_name != 'Select Bus Name from dropdown': |
|
route = get_route_by_bus(bus_name) |
|
st.write(f"Routes for **{bus_name}**:") |
|
st.write(route) |
|
|
|
|
|
with st.expander("Bus Names for your assistance!!!", expanded=False): |
|
st.write( |
|
"Achim Paribahan Bus Route (আছিম পরিবহন), Active Paribahan Bus Route (এক্টিভ পরিবহন), Agradut Bus Route (অগ্রদূত), Airport Bangabandhu Avenue Bus Route(এয়ারপোর্ট বঙ্গবন্ধু এভিনিউ ট্রান্সপোর্ট), Ajmeri Glory Bus Route (আজমেরী গ্লোরী), ..." |
|
) |
|
|
|
|
|
col1, col2 = st.columns([1, 6]) |
|
with col2: |
|
|
|
st.image("149656-200.png", width=150, height=150) |
|
|
|
|
|
st.markdown("<br><br><br><br>", unsafe_allow_html=True) |
|
|
|
if __name__ == "__main__": |
|
main() |
|
|