| import gradio as gr |
| from gemini_sdk import GeminiChat |
|
|
| |
| gemini_api_key = "AIzaSyApFLfSfK9iodZ6pmxos_x-FLIleh0xaMM" |
|
|
| |
| chatbot = GeminiChat(api_key=gemini_api_key) |
|
|
| |
| def chatbot_response(user_input): |
| try: |
| |
| response = chatbot.query(user_input) |
| return response |
| except Exception as e: |
| return f"Error: {str(e)}" |
|
|
| |
| iface = gr.Interface( |
| fn=chatbot_response, |
| inputs=gr.Textbox(label="Enter your question"), |
| outputs=gr.Textbox(label="Chatbot Response"), |
| title="Real Estate Chatbot", |
| description="Ask the chatbot about real estate listings, house details, or anything related to real estate." |
| ) |
|
|
| |
| iface.launch() |
|
|