{"id":21188670,"url":"https://github.com/calcuis/chatgpt-ai-model","last_synced_at":"2026-05-17T13:36:37.704Z","repository":{"id":215543111,"uuid":"739203327","full_name":"calcuis/chatgpt-ai-model","owner":"calcuis","description":"Chat Generative Pre-trained Transformer","archived":false,"fork":false,"pushed_at":"2024-01-17T23:30:17.000Z","size":467,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-23T12:04:33.219Z","etag":null,"topics":["chatgpt","gguf","gui","llama","offline"],"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/calcuis.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-01-05T02:26:52.000Z","updated_at":"2024-01-09T00:11:49.000Z","dependencies_parsed_at":"2024-08-05T13:32:40.076Z","dependency_job_id":"7746b651-2405-4e1b-8231-a5f2fe0c603e","html_url":"https://github.com/calcuis/chatgpt-ai-model","commit_stats":{"total_commits":25,"total_committers":1,"mean_commits":25.0,"dds":0.0,"last_synced_commit":"0d59c64935a803c37540437d193d610319844438"},"previous_names":["calcuis/chatgpt-ai-model"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/calcuis/chatgpt-ai-model","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calcuis%2Fchatgpt-ai-model","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calcuis%2Fchatgpt-ai-model/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calcuis%2Fchatgpt-ai-model/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calcuis%2Fchatgpt-ai-model/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/calcuis","download_url":"https://codeload.github.com/calcuis/chatgpt-ai-model/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calcuis%2Fchatgpt-ai-model/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32503204,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["chatgpt","gguf","gui","llama","offline"],"created_at":"2024-11-20T18:47:17.621Z","updated_at":"2026-05-17T13:36:37.683Z","avatar_url":"https://github.com/calcuis.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"### chatGPT\n*** **run chatGPT locally (offline) - with basic GUI**\n```\npython chat.py\n```\n[\u003cimg src=\"https://raw.githubusercontent.com/calcuis/chatgpt-ai-model/master/demo.png\" width=\"350\" height=\"300\"\u003e](https://github.com/calcuis/chatgpt-ai-model/blob/main/demo.png)\n\n### code review\n\nThis Python code is a simple graphical user interface (GUI) application that uses the Llama to interact with a chat model for generating responses. Here's a breakdown of the code:\n\n*install the llama-cpp-python library via pip or pip3 (once only)\n```\npip install llama-cpp-python \n```\nImporting Modules:\n```\nfrom llama_cpp import Llama\nfrom tkinter import *\nimport tkinter.scrolledtext as st\n```\nThe llama_cpp module is imported, which presumably provides an interface to the Llama chat model.\nThe Tk class from the tkinter module is imported for creating the main application window.\nThe scrolledtext module from tkinter is imported as st to create a scrolled text widget for displaying the chat history.\n\nCreating Llama Instance:\n```\nllm = Llama(model_path=\"chat.gguf\")\n```\nAn instance of the Llama class is created with the specified model path (\"chat.gguf\"); get the sample pre-trained model file from releases (0.1).\n\n\nSetting up the GUI:\n```\nroot = Tk()\nroot.title(\"chatGPT\")\nroot.columnconfigure([0, 1], minsize=180)\nroot.rowconfigure(0, weight=2)\nroot.rowconfigure(1, weight=1)\n```\nA Tkinter root window is created with the title \"chatGPT.\"\nColumn and row configurations are set to control the layout.\n\nCreating Entry and ScrolledText Widgets:\n```\ni = Entry()\no = st.ScrolledText()\n```\nAn Entry widget (i) is created for user input.\nA scrolled text widget (o) is created for displaying the chat history.\n\nDefine Submit Function:\n```\ndef submit(i):\n    output = llm(\"Q: \"+str(i.get()), max_tokens=1024, echo=True)\n    answer = output['choices'][0]['text']\n    print(answer)\n    o.insert(INSERT, answer+\"\\n\\n\")\n    i.delete(0, END)\n```\nThe submit function is defined to handle the button click event.\nIt retrieves user input from the Entry widget (i), sends it to the Llama model, and retrieves the generated response.\nThe response is printed to the console and inserted into the scrolled text widget (o).\nClear the widget (i) after submission.\n\nCreate Submit Button:\n```\nbtn = Button(text=\"Submit\", command=lambda: submit(i))\n```\nA Button widget (btn) is created with the label \"Submit,\" and the submit function is set as its command.\n\nGrid Placement of Widgets:\n```\ni.grid(row=1, column=0, sticky=\"nsew\")\nbtn.grid(row=1, column=1, sticky=\"nsew\")\no.grid(row=0, columnspan=2, sticky=\"nsew\")\n```\nThe widgets are placed in the Tkinter grid layout.\nThe Entry widget (i) and the Submit button (btn) are placed in the second row, with the Entry widget in the first column and the button in the second column.\nThe scrolled text widget (o) spans across both columns and is placed in the first row.\n\nWhen the user enters a question and clicks the \"Submit\" button, the input is sent to the Llama model, and the generated response is displayed in the scrolled text widget.\n\n**References**\n\ngithub.com/calcuis/llama-cpp-python-gradio-server\n\ngithub.com/calcuis/chatgpt-command-line-interface\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalcuis%2Fchatgpt-ai-model","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcalcuis%2Fchatgpt-ai-model","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalcuis%2Fchatgpt-ai-model/lists"}