{"id":24064711,"url":"https://github.com/jeninsutradhar/gpt-chatbot-python","last_synced_at":"2025-04-23T19:13:04.945Z","repository":{"id":240391413,"uuid":"802509041","full_name":"JeninSutradhar/GPT-Chatbot-Python","owner":"JeninSutradhar","description":"a simple graphical user interface (GUI) application that interacts with the ChatGPT API. The application is built using Python and the Tkinter library. Users can input their questions, and the application will display the responses generated by the AI","archived":false,"fork":false,"pushed_at":"2024-06-15T11:54:09.000Z","size":6,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-23T19:12:28.389Z","etag":null,"topics":["chatbot","chatgpt-api","gpt-3","openai-api","pyt","tkinter-gui"],"latest_commit_sha":null,"homepage":"https://js-bot.kesug.com/","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/JeninSutradhar.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-05-18T13:48:53.000Z","updated_at":"2025-01-13T09:22:39.000Z","dependencies_parsed_at":"2024-05-18T14:47:31.942Z","dependency_job_id":null,"html_url":"https://github.com/JeninSutradhar/GPT-Chatbot-Python","commit_stats":null,"previous_names":["jeninsutradhar/gpt-chatbot-python"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JeninSutradhar%2FGPT-Chatbot-Python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JeninSutradhar%2FGPT-Chatbot-Python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JeninSutradhar%2FGPT-Chatbot-Python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JeninSutradhar%2FGPT-Chatbot-Python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JeninSutradhar","download_url":"https://codeload.github.com/JeninSutradhar/GPT-Chatbot-Python/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250496991,"owners_count":21440231,"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":["chatbot","chatgpt-api","gpt-3","openai-api","pyt","tkinter-gui"],"created_at":"2025-01-09T10:39:50.725Z","updated_at":"2025-04-23T19:13:04.928Z","avatar_url":"https://github.com/JeninSutradhar.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ChatGPT Application\nThis repository contains a simple graphical user interface (GUI) application that interacts with the ChatGPT API. The application is built using Python and the Tkinter library. Users can input their questions, and the application will display the responses generated by the AI.\n\n## Features\n- Simple and intuitive GUI\n- Interaction with ChatGPT API to get answers\n- Easy to use: Type a question and get an answer\n\n![image](https://github.com/JeninSutradhar/GPT-Chatbot-Python/assets/111521642/d168665a-f09d-42bc-90f5-c287e45f6e8c)\n\n\n## Prerequisites\n- Python 3.x\n- requests library\n\n### Installation\n**Clone the repository:**\n\n```bash\ngit clone https://github.com/yourusername/ChatGPT-Application.git\n```\n```bash\ncd ChatGPT-Application\n```\n\n- Install the required dependencies:\n```bash\npip install requests\n```\n\n## Usage\nRun the application:\n\n```bash\npython gpt_app.py\n```\n- In the GUI window, type your question in the text box and click the \"Send\" button. The answer will be displayed below.\n\n- To exit the application, type exit and click the \"Send\" button, or click the \"Exit\" button.\n\n## Code Overview\n- ```gpt_app.py```\n- This is the main file that contains the following functions and GUI setup:\n\n- **chat_with_ai(question):** Sends a GET request to the ChatGPT API with the provided question and returns the AI's response or an error message.\n- **send_question():**  Handles the process of sending the user's question to the AI and displaying the answer in the GUI.\n- **create_gui():** Sets up the Tkinter GUI with input fields, buttons, and response display area.\n\n### Example\n```python\nimport tkinter as tk\nfrom tkinter import Text, Button, END\nimport requests\n\ndef chat_with_ai(question):\n    api_url = \"https://chatgpt.apinepdev.workers.dev/?question=\"\n    full_url = api_url + question\n    response = requests.get(full_url)\n    if response.status_code == 200:\n        data = response.json()\n        return data.get(\"answer\", \"No answer available.\")\n    else:\n        return \"Error: \" + str(response.status_code)\n\ndef send_question():\n    question = question_entry.get(\"1.0\", END).strip()\n    if question.lower() == 'exit':\n        window.destroy()\n    else:\n        answer = chat_with_ai(question)\n        answer_text.configure(state=\"normal\")\n        answer_text.insert(END, \"Answer: \" + answer + \"\\n\\n\", \"answer\")\n        answer_text.configure(state=\"disabled\")\n        question_entry.delete(\"1.0\", END)\n        question_entry.focus()\n\ndef create_gui():\n    global window\n    window = tk.Tk()\n    window.title(\"ChatGPT\")\n    window.configure(bg=\"gray\")\n    window.geometry(\"600x800\")\n\n    prompt_label = tk.Label(window, text=\"Ask me anything!\", font=(\"Helvetica\", 20), bg=\"gray\", fg=\"black\")\n    prompt_label.pack(pady=10)\n\n    global question_entry\n    question_entry = Text(window, width=40, height=3, bg=\"darkgray\", fg=\"black\")\n    question_entry.pack(pady=10)\n\n    global answer_text\n    answer_text = Text(window, width=80, height=30, bg=\"black\", fg=\"green\")\n    answer_text.tag_configure(\"answer\", foreground=\"white\")\n    answer_text.configure(state=\"disabled\")\n    answer_text.pack(pady=10)\n\n    send_button = Button(window, text=\"Send\", command=send_question, bg=\"gray\", fg=\"black\")\n    send_button.pack(side=tk.RIGHT, padx=10, pady=10)\n\n    exit_button = Button(window, text=\"Exit\", command=window.destroy, bg=\"gray\", fg=\"black\")\n    exit_button.pack(side=tk.RIGHT, padx=10, pady=10)\n\n    window.mainloop()\n\nif __name__ == \"__main__\":\n    create_gui()\n```\n\n## License\n- This project is licensed under the MIT License. See the LICENSE file for details.\n\n## Acknowledgments\n- The application uses the ChatGPT API provided by OpenAI.\n- The GUI is built using the Tkinter library.\n- Feel free to contribute to the project by opening issues or submitting pull requests. Enjoy chatting with AI!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeninsutradhar%2Fgpt-chatbot-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjeninsutradhar%2Fgpt-chatbot-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeninsutradhar%2Fgpt-chatbot-python/lists"}