Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
def process_code(code, prompt):
|
| 4 |
+
# Placeholder logic – we'll replace this later
|
| 5 |
+
if "print" in code:
|
| 6 |
+
fixed_code = code.replace("print", "console.log")
|
| 7 |
+
else:
|
| 8 |
+
fixed_code = code + "\n# No changes made."
|
| 9 |
+
|
| 10 |
+
return fixed_code
|
| 11 |
+
|
| 12 |
+
with gr.Blocks() as demo:
|
| 13 |
+
gr.Markdown("## 🧠 CodeFixPro - AI Code Debugger & Modifier Agent")
|
| 14 |
+
|
| 15 |
+
with gr.Row():
|
| 16 |
+
code_input = gr.Code(label="Paste your code here", language="python", lines=20)
|
| 17 |
+
prompt_input = gr.Textbox(label="Enter your prompt (e.g., 'Convert to async')")
|
| 18 |
+
|
| 19 |
+
run_btn = gr.Button("Fix / Modify Code")
|
| 20 |
+
|
| 21 |
+
code_output = gr.Code(label="Output Code", language="python", lines=20)
|
| 22 |
+
|
| 23 |
+
run_btn.click(process_code, inputs=[code_input, prompt_input], outputs=code_output)
|
| 24 |
+
|
| 25 |
+
demo.launch()
|