import gradio as gr import requests API_URL = "http://127.0.0.1:8000/ask" def query_ai(user_input): response = requests.get(API_URL, params={"query": user_input}) return response.json()["response"] iface = gr.Interface( fn=query_ai, inputs=gr.Textbox(label="Ask about Solar Energy"), outputs=gr.Textbox(label="AI Response"), title="🌞 Solar Industry AI Assistant", description="This AI Assistant provides expert guidance on solar energy, installation, and maintenance." ) if __name__ == "__main__": iface.launch()