{"id":16200612,"url":"https://github.com/gagan3012/project-code-py","last_synced_at":"2025-03-16T10:32:50.782Z","repository":{"id":48601102,"uuid":"344148971","full_name":"gagan3012/project-code-py","owner":"gagan3012","description":"Leetcode using AI","archived":false,"fork":false,"pushed_at":"2021-10-15T18:29:22.000Z","size":459,"stargazers_count":107,"open_issues_count":6,"forks_count":21,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-27T08:00:50.055Z","etag":null,"topics":["leetcode","ml","nlp","python","python-questions","streamlit","transformer"],"latest_commit_sha":null,"homepage":"https://huggingface.co/spaces/gagan3012/project-code-py","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gagan3012.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null},"funding":{"github":"gagan3012","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2021-03-03T14:11:33.000Z","updated_at":"2024-11-03T11:39:43.000Z","dependencies_parsed_at":"2022-09-07T23:51:50.555Z","dependency_job_id":null,"html_url":"https://github.com/gagan3012/project-code-py","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gagan3012%2Fproject-code-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gagan3012%2Fproject-code-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gagan3012%2Fproject-code-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gagan3012%2Fproject-code-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gagan3012","download_url":"https://codeload.github.com/gagan3012/project-code-py/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243814907,"owners_count":20352037,"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":["leetcode","ml","nlp","python","python-questions","streamlit","transformer"],"created_at":"2024-10-10T09:32:24.442Z","updated_at":"2025-03-16T10:32:50.463Z","avatar_url":"https://github.com/gagan3012.png","language":"Jupyter Notebook","funding_links":["https://github.com/sponsors/gagan3012"],"categories":[],"sub_categories":[],"readme":"# Leetcode using AI :robot:\nGPT-2 Model for Leetcode Questions in python  New demo here: https://huggingface.co/spaces/gagan3012/project-code-py\n\n**Note**: the Answers might not make sense in some cases because of the bias in GPT-2 Current accuracy is capped at 90%. \n\n**Contribtuions:** If you would like to make the model/UI better contributions (Issues/PRs) are welcome Check out [CONTRIBUTIONS](https://github.com/gagan3012/project-code-py/blob/master/.github/CONTRIBUTIONS.md) \n\n**How I built this** : [Linkedin](https://www.linkedin.com/feed/update/urn:li:activity:6775934721827459072/) \n\n### 📢 Favour:\n\nIt would be highly motivating, if you can STAR⭐ this repo if you find it helpful. New improvements incoming!\n\n## Model\n\nTwo models have been developed for different use cases and they can be found at https://huggingface.co/gagan3012\n\nThe model weights can be found here: [GPT-2](https://huggingface.co/gagan3012/project-code-py) and [DistilGPT-2](https://huggingface.co/gagan3012/project-code-py-small)\n\nThe model has been trained using **Weights and Biases (Wandb)** and **PyTorch**\n\nGPT Neo model: https://huggingface.co/gagan3012/project-code-py-neo\n\n### Example usage:\n```python\nfrom transformers import AutoTokenizer, AutoModelWithLMHead\n\ntokenizer = AutoTokenizer.from_pretrained(\"gagan3012/project-code-py\")\n\nmodel = AutoModelWithLMHead.from_pretrained(\"gagan3012/project-code-py\")\n```\n\n## Demo\n[![Streamlit App](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://share.streamlit.io/gagan3012/project-code-py/app.py)\n\n\nA streamlit webapp has been setup to use the model: https://share.streamlit.io/gagan3012/project-code-py/app.py\n\n![image](https://user-images.githubusercontent.com/49101362/110356042-e69e4780-804a-11eb-94c6-a47fa3cd66b3.png)\n\nPlease create an issue in this repo if the demo is not working\n\n## Example results:\n\n### Question:\n\n```\nWrite a function to delete a node in a singly-linked list. You will not be given access to the head of the list, instead you will be given access to the node to be deleted directly. It is guaranteed that the node to be deleted is not a tail node in the list.\n```\n\n### Answer:\n\n```python\n\"\"\" Write a function to delete a node in a singly-linked list. You will not be given access to the head of the list, instead you will be given access to the node to be deleted directly. It is guaranteed that the node to be deleted is not a tail node in the list.\n\nFor example,\na = 1-\u003e2-\u003e3\nb = 3-\u003e1-\u003e2\nt = ListNode(-1, 1)\n\nNote: The lexicographic ordering of the nodes in a tree matters. Do not assign values to nodes in a tree.\nExample 1:\n\nInput: [1,2,3]\nOutput: 1-\u003e2-\u003e5\nExplanation: 1-\u003e2-\u003e3-\u003e3-\u003e4, then 1-\u003e2-\u003e5[2] and then 5-\u003e1-\u003e3-\u003e4.\n\n\nNote:\n\nThe length of a linked list will be in the range [1, 1000].\nNode.val must be a valid LinkedListNode type.\nBoth the length and the value of the nodes in a linked list will be in the range [-1000, 1000].\nAll nodes are distinct.\n\"\"\"\n# Definition for singly-linked list.\n# class ListNode:\n#     def __init__(self, x):\n#         self.val = x\n#         self.next = None\n\nclass Solution:\n    def deleteNode(self, head: ListNode, val: int) -\u003e None:\n        \"\"\"\n        BFS\n        Linked List\n        :param head: ListNode\n        :param val: int\n        :return: ListNode\n        \"\"\"\n        if head is not None:\n            return head\n        dummy = ListNode(-1, 1)\n        dummy.next = head\n        dummy.next.val = val\n        dummy.next.next = head\n        dummy.val = \"\"\n\n\ns1 = Solution()\nprint(s1.deleteNode(head))\nprint(s1.deleteNode(-1))\nprint(s1.deleteNode(-1))\n\n   ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgagan3012%2Fproject-code-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgagan3012%2Fproject-code-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgagan3012%2Fproject-code-py/lists"}