{"id":23388292,"url":"https://github.com/dharanikavitham/ai-chatbot","last_synced_at":"2026-05-02T04:34:04.080Z","repository":{"id":268227463,"uuid":"903659641","full_name":"Dharanikavitham/AI-chatbot","owner":"Dharanikavitham","description":"The chatbot aims to enhance user experience by offering real-time data and services through integration with external APIs, contributing to improved productivity and efficiency in tasks such as information retrieval, assistance, and decision-making support.","archived":false,"fork":false,"pushed_at":"2024-12-15T10:36:19.000Z","size":13530,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-08T13:22:57.701Z","etag":null,"topics":["api-gateway","python","streamlit"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Dharanikavitham.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-15T07:48:04.000Z","updated_at":"2024-12-15T10:36:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"14e17bb8-a92a-41e9-b389-da7603e54aed","html_url":"https://github.com/Dharanikavitham/AI-chatbot","commit_stats":null,"previous_names":["dharanikavitham/ai-chatbot"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dharanikavitham%2FAI-chatbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dharanikavitham%2FAI-chatbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dharanikavitham%2FAI-chatbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dharanikavitham%2FAI-chatbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Dharanikavitham","download_url":"https://codeload.github.com/Dharanikavitham/AI-chatbot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247850269,"owners_count":21006565,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-gateway","python","streamlit"],"created_at":"2024-12-22T02:18:34.533Z","updated_at":"2026-05-02T04:34:04.043Z","avatar_url":"https://github.com/Dharanikavitham.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"import webbrowser\nimport os\nimport streamlit as st\nfrom dotenv import load_dotenv\nfrom gtts import gTTS\nimport base64\nimport io\nfrom googlesearch import search\nimport google.generativeai as gen_ai\n\n# Load environment variables\nload_dotenv()\n\n# Set up Google Gemini-Pro AI model\nGOOGLE_API_KEY = os.getenv(\"GOOGLE_API_KEY\")\ngen_ai.configure(api_key=\"AIzaSyBf3UoJMlcLhlmSNSnpIGXXwsBQUCjRQtU\")\nmodel = gen_ai.GenerativeModel('gemini-pro')\n\n# Function to convert text to speech and return audio data\ndef text_to_speech(text):\n    tts = gTTS(text)\n    audio = io.BytesIO()\n    tts.write_to_fp(audio)\n    audio.seek(0)\n\n    return audio\n\n# Initialize chat session in Streamlit if not already present\nif \"chat_session\" not in st.session_state:\n    st.session_state.chat_session = model.start_chat(history=[])\n\n# Configure Streamlit page settings\nst.set_page_config(\n    page_title=\"Chat with Alisa-Pro!\",\n    page_icon=\":brain:\",  # Favicon emoji\n    layout=\"centered\",  # Page layout option\n)\n\n# Display the chatbot's title on the page\nst.title(\"🤖 Alisa Pro - ChatBot\")\n\n# Mute switch\nmute_audio = st.checkbox(\"Mute Text-to-Speech\")\n\n# Display the chat history\nfor message in st.session_state.chat_session.history:\n    st.markdown(message.parts[0].text)\n\n# Input field for the user's message\nuser_prompt = st.chat_input(\"Ask Alisa-Pro...\")\nif user_prompt:\n    # Add the user's message to chat and display it\n    st.chat_message(\"user\").markdown(user_prompt)\n    if \"open youtube\" in user_prompt.lower():\n        st.chat_message(\"assistant\").markdown(\"Sure, opening YouTube for you.\")\n        # Open YouTube in the default web browser\n        webbrowser.open(\"https://www.youtube.com\")\n    else:\n        # Send the user's message to Gemini-Pro and get the response\n        gemini_response = st.session_state.chat_session.send_message(user_prompt)\n\n        # Display Gemini-Pro's response\n        with st.chat_message(\"assistant\"):\n            st.markdown(gemini_response.text)\n\n            # Convert Gemini-Pro's response to speech only if not muted\n            if not mute_audio:\n                audio_data = text_to_speech(gemini_response.text)\n\n                # Convert audio to base64\n                base64_audio = base64.b64encode(audio_data.read()).decode(\"utf-8\")\n\n                # Rewind the audio_data\n                audio_data.seek(0)\n\n                # Autoplay audio using JavaScript\n                st.markdown(f'\u003caudio autoplay src=\"data:audio/wav;base64,{base64_audio}\"\u003e\u003c/audio\u003e', unsafe_allow_html=True)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdharanikavitham%2Fai-chatbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdharanikavitham%2Fai-chatbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdharanikavitham%2Fai-chatbot/lists"}