import gradio as gr # --- Dummy Functions (replace with real logic) --- def analyze_city(city_name): if not city_name: return "⚠️ Please enter a city name." # Example dummy response return f"📊 Analysis for {city_name}:\n- Crime Index: Moderate\n- Accident Rate: Low" def citizen_services(service_query): if not service_query: return "⚠️ Please enter your request." # Example dummy response return f"✅ Service Request Processed:\n{service_query}" # --- Gradio UI --- with gr.Blocks(theme="gradio/soft") as demo: gr.Markdown("# 🌆 City Analysis & Citizen Services AI") with gr.Tabs(): # --- Tab 1: City Analysis --- with gr.Tab("City Analysis"): with gr.Row(): with gr.Column(): city_input = gr.Textbox( label="Enter City Name", placeholder="e.g., New York, London, Mumbai..." ) analyze_btn = gr.Button("Analyze City") with gr.Column(): city_output = gr.Textbox( label="City Analysis (Crime Index & Accidents)", lines=10 ) analyze_btn.click(analyze_city, inputs=city_input, outputs=city_output) # --- Tab 2: Citizen Services --- with gr.Tab("Citizen Services"): with gr.Row(): with gr.Column(): service_input = gr.Textbox( label="Enter Service Request", placeholder="e.g., Report pothole, Request garbage collection..." ) service_btn = gr.Button("Submit Request") with gr.Column(): service_output = gr.Textbox( label="Service Response", lines=10 ) service_btn.click(citizen_services, inputs=service_input, outputs=service_output) # --- Launch App --- if __name__ == "__main__": demo.launch() app.launch()