Rushabh147 commited on
Commit
6ff8248
·
1 Parent(s): de0bb53

remove repair from demo UI + faster settings

Browse files
Files changed (1) hide show
  1. app/gradio_app.py +3 -15
app/gradio_app.py CHANGED
@@ -23,17 +23,10 @@ def _get_assistant():
23
  return _assistant
24
 
25
 
26
- def respond(message: str, history, mode: str, use_repair: bool) -> str:
27
  assistant = _get_assistant()
28
 
29
- if use_repair:
30
- from src.agent.repair_loop import make_repair_generator, repair_loop
31
- gen_fn = make_repair_generator(assistant)
32
- trace = repair_loop(message, gen_fn, check_program_fn=lambda c: c, max_iters=3)
33
- note = f"repair: {'passed' if trace.success else 'best effort'} in {trace.iterations} iter(s)"
34
- return f"```python\n{trace.final_code}\n```\n\n_{note}_"
35
-
36
- result = assistant.generate(message, mode=mode, max_new_tokens=160, return_sources=True)
37
  if isinstance(result, tuple):
38
  code, sources = result
39
  src_lines = "\n".join(
@@ -56,14 +49,9 @@ with gr.Blocks(theme=gr.themes.Soft(), title="Code Generation Assistant") as dem
56
  label="Mode",
57
  info="RAG conditions the model on retrieved CodeSearchNet examples; baseline is zero-shot.",
58
  )
59
- use_repair = gr.Checkbox(
60
- label="Agentic repair",
61
- value=False,
62
- info="Generate → run → read error → self-fix loop (up to 3 iterations).",
63
- )
64
  gr.ChatInterface(
65
  fn=respond,
66
- additional_inputs=[mode, use_repair],
67
  examples=[
68
  ["Write a function to check if a number is prime."],
69
  ["Parse a CSV file and return a list of dictionaries."],
 
23
  return _assistant
24
 
25
 
26
+ def respond(message: str, history, mode: str) -> str:
27
  assistant = _get_assistant()
28
 
29
+ result = assistant.generate(message, mode=mode, max_new_tokens=128, return_sources=True)
 
 
 
 
 
 
 
30
  if isinstance(result, tuple):
31
  code, sources = result
32
  src_lines = "\n".join(
 
49
  label="Mode",
50
  info="RAG conditions the model on retrieved CodeSearchNet examples; baseline is zero-shot.",
51
  )
 
 
 
 
 
52
  gr.ChatInterface(
53
  fn=respond,
54
+ additional_inputs=[mode],
55
  examples=[
56
  ["Write a function to check if a number is prime."],
57
  ["Parse a CSV file and return a list of dictionaries."],