{"id":20028449,"url":"https://github.com/marx-wrld/voice-chatbot","last_synced_at":"2025-06-17T10:34:05.371Z","repository":{"id":222340820,"uuid":"756969609","full_name":"Marx-wrld/Voice-Chatbot","owner":"Marx-wrld","description":"Voice chatbot using Openai's API.","archived":false,"fork":false,"pushed_at":"2024-02-14T16:24:39.000Z","size":3592,"stargazers_count":5,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-04T19:54:20.745Z","etag":null,"topics":["fastapi","gtts","openai-api"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/Marx-wrld.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-02-13T16:52:42.000Z","updated_at":"2025-01-22T14:09:17.000Z","dependencies_parsed_at":"2025-01-12T17:28:36.436Z","dependency_job_id":"512bdfd1-543e-40c6-91f4-c2bb6f95e86f","html_url":"https://github.com/Marx-wrld/Voice-Chatbot","commit_stats":null,"previous_names":["marx-wrld/voice-chatbot"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Marx-wrld/Voice-Chatbot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marx-wrld%2FVoice-Chatbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marx-wrld%2FVoice-Chatbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marx-wrld%2FVoice-Chatbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marx-wrld%2FVoice-Chatbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Marx-wrld","download_url":"https://codeload.github.com/Marx-wrld/Voice-Chatbot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marx-wrld%2FVoice-Chatbot/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260340437,"owners_count":22994477,"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":["fastapi","gtts","openai-api"],"created_at":"2024-11-13T09:14:53.855Z","updated_at":"2025-06-17T10:34:00.343Z","avatar_url":"https://github.com/Marx-wrld.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"##  Voice Chatbot using Openai's API\n\n\u003e Credit to - [@cybrosystech](https://github.com/cybrosystech)\n\n**Multilingual Voice and Text Support**\n\nOne of the key features of this voice chatbot is its multilingual support. This makes the chatbot more accessible to a global audience because users can communicate with it in a variety of languages. Additionally, the chatbot also supports both voice and text input, allowing users to communicate in the way that is most comfortable for them.\n\n**User Interface**\n\nThe React JavaScript framework is used to build the chatbot's front end. React is a well-liked option for creating user interfaces because of its adaptability, effectiveness, and simplicity. With React, the chatbot can provide a seamless and responsive user experience, with real-time updates and interactive elements.\n\n**Whisper AI**\n\nWhisper is a speech recognition model. It is a multitasking model that is capable of language identification, speech recognition across many languages, and voice translation. It was honed using a big dataset of different audio.\n\n**GPT-3.5-Turbo**\n\nGPT-3.5-Turbo can now accept a series of messages as input, making it possible for chatbots to provide more personalized and human-like interactions with users. This is a significant advancement in natural language processing and opens up endless possibilities for businesses to improve customer engagement and overall efficiency.\n\n**Fast API**\n\nFastAPI is a web framework for **building** Python RESTful APIs\n\n. To verify, serialise, and deserialize data as well as to automatically create OpenAPI documents, FastAPI is built on Pydantic.\n\n**Workflow of Chatbot**\n\n1.  Receive voice messages on UI\n2. Use the Whisper AI of OpenAI to convert voice to text.\n3. Make a response utilising the GPT API of OpenAI.\n4. Use the Google Text to Speech (gTTS) library to convert the response's text to speech.\n5. Send back the spoken answer on UI.\n\n\n\u003cimg width=\"818\" alt=\"CBot\" src=\"https://github.com/Marx-wrld/Voice-Chatbot/assets/105711066/3d094dad-99c1-4771-8041-ef8e066a97da\"\u003e\n\n\n**1. Receive voice messages on UI**\n\nWe use the **voice-recorder-react **Package to record voice and sent it to the Fast API server\n\n**2-Fast API**\n\nfrom fastapi import FastAPI\n\napp = FastAPI()\n\n@app.post: To create endpoints\n\n**uvicorn.run(app, host=\"0.0.0.0\", port=8000)**\n\n**3 -Whisper AI to convert voice to text**\n\n**Whisper API**\n\n```\n Import openai\n\n audio_file = open(\"temp.mp3\", \"wb\")\n decode_string = base64.b64decode(\"Your Voice message\")\n audio_file.write(decode_string)\n audio_file.close()\n file = open(\"temp.mp3\", \"rb\")\n openai.api_key = \"Your API key\"\n transcript = openai.Audio.translate(\"whisper-1\", file)\n```\n\n\n** **\n\n**4.Generating a response using OpenAI’s GPT API**      \n\n\n```\n  openai.api_key = \"Your API key\"\n        conversation.append({'role': 'user', 'content': \"Message\"})\nresponse = openai.ChatCompletion.create(\n            model=model_id,\n            messages=gpt.conversation\n        )\n        conversation.append({'role': response.choices[0].message.role,\n                                 'content': response.choices[\n                                     0].message.content})\ntext = response.choices[0].message.content\n```\n\n\n**5. Google Text to Speech (gTTS) library to convert the response's text to speech.**\n\n**      **\n\n\n```\ntts = gTTS(text=text, lang='en')\n       tts.save(\"temp.mp3\")\n       with open(\"temp.mp3\", \"rb\") as f:\n       base64_bytes = base64.b64encode(f.read())\n       base64_string = base64_bytes.decode('utf-8')\n```\n\n\n**How to install ChatBot?**\n\nLinux:\n\nRun the following command in the terminal\n\n\n```\ngit clone https://github.com/cybrosystech/Voice-ChatBot.git\n\ncd AI/Voice-ChatBot/\n\nsudo bash setup.sh\n\nsudo bash start.sh\n\n```\n\n\nNavigate to your project localhost port 5173, and paste your openai API key under settings\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarx-wrld%2Fvoice-chatbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarx-wrld%2Fvoice-chatbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarx-wrld%2Fvoice-chatbot/lists"}