venky2k1 commited on
Commit
055d938
·
0 Parent(s):

Initial commit

Browse files
.gradio/flagged/dataset1.csv ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Paste Buggy Code,Suggested Fixed Code,timestamp
2
+ "def greet(name)
3
+ print(""Hello"", name)
4
+ ","'/*
5
+ * Copyright (c) 2008-2021, Hazelcast, Inc. All Rights Reserved.
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the ""License"");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an ""AS IS"" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+
20
+ package com.hazelcast.internal.serialization;
21
+
22
+ import com.hazelcast.internal.serialization.impl.AbstractSerializationService;
23
+ import com.hazelcast.internal.serialization.impl.DefaultSerializationService;
24
+ import com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder;
25
+ import com.hazelcast.internal.serialization.",2025-06-10 10:18:50.796833
.huggingface ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ # .huggingface/config.yaml
2
+ title: Bug Fixer
3
+ emoji: 🛠️
4
+ colorFrom: purple
5
+ colorTo: pink
6
+ sdk: gradio
7
+ sdk_version: 4.17.0
8
+ app_file: app.py
9
+ pinned: false
README.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # Bug Fixer
2
+
3
+ Bug Fixer is a Gradio-based web tool that uses the CodeT5+ model to automatically detect and fix bugs in Python code. Built using Hugging Face Transformers and deployable via Hugging Face Spaces.
__pycache__/bug_detector.cpython-313.pyc ADDED
Binary file (977 Bytes). View file
 
app.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from bug_detector import fix_code
3
+
4
+ def run_bugfixer(code):
5
+ return fix_code(code)
6
+
7
+ gr.Interface(
8
+ fn=run_bugfixer,
9
+ inputs=gr.Textbox(label="Paste Buggy Code", lines=15),
10
+ outputs=gr.Textbox(label="Suggested Fixed Code"),
11
+ title="Code Fixer using CodeT5+"
12
+ ).launch()
bug_detector.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
2
+ import torch
3
+
4
+ # Load CodeT5+ model for code fixing
5
+ model_ckpt = "Salesforce/codet5p-220m"
6
+ tokenizer = AutoTokenizer.from_pretrained(model_ckpt)
7
+ model = AutoModelForSeq2SeqLM.from_pretrained(model_ckpt)
8
+
9
+ def fix_code(code):
10
+ prompt = f"fix: {code}"
11
+ inputs = tokenizer(prompt, return_tensors="pt", padding=True, truncation=True)
12
+ output = model.generate(inputs["input_ids"], max_length=256)
13
+ fixed_code = tokenizer.decode(output[0], skip_special_tokens=True)
14
+ return fixed_code.strip()
requirments.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ transformers
2
+ torch
3
+ gradio
4
+ flask