slenk commited on
Commit
d35987b
·
verified ·
1 Parent(s): eeef81e

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +0 -24
app.py CHANGED
@@ -193,7 +193,6 @@ def generate_spec(
193
 
194
  generated = outputs[0][input_len:]
195
  spec = tokenizer.decode(generated, skip_special_tokens=True)
196
- spec = add_function_separators(spec)
197
  return render_mermaid_images(spec)
198
 
199
  except Exception as e:
@@ -206,29 +205,6 @@ def generate_spec(
206
  # --- Gradio UI ---
207
 
208
 
209
- def add_function_separators(spec: str) -> str:
210
- """Insert horizontal rules between function/method spec sections.
211
-
212
- The model doesn't generate separators between ### headings, so we
213
- inject --- before each ### that follows content (not the first one
214
- after a ## heading).
215
- """
216
- lines = spec.split("\n")
217
- result = []
218
- prev_was_section_header = True
219
- for line in lines:
220
- if line.startswith("### "):
221
- if not prev_was_section_header:
222
- result.append("\n---\n")
223
- prev_was_section_header = False
224
- elif line.startswith("## "):
225
- prev_was_section_header = True
226
- elif line.strip():
227
- prev_was_section_header = False
228
- result.append(line)
229
- return "\n".join(result)
230
-
231
-
232
  def render_mermaid_images(spec: str) -> str:
233
  """Replace mermaid code blocks with rendered SVG images via mermaid.ink.
234
 
 
193
 
194
  generated = outputs[0][input_len:]
195
  spec = tokenizer.decode(generated, skip_special_tokens=True)
 
196
  return render_mermaid_images(spec)
197
 
198
  except Exception as e:
 
205
  # --- Gradio UI ---
206
 
207
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
  def render_mermaid_images(spec: str) -> str:
209
  """Replace mermaid code blocks with rendered SVG images via mermaid.ink.
210