AfkaraLP commited on
Commit
437ce51
·
1 Parent(s): 4a0f59e

Surface ZeroGPU worker traceback via try/except for diagnosis

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -126,8 +126,7 @@ def clean(text: str) -> str:
126
  return text.rstrip()
127
 
128
 
129
- @gpu(duration=120)
130
- def complete(code, temperature, max_tokens, top_p):
131
  if code.strip() == "":
132
  return "", code, "*Empty input.*"
133
  if CURSOR in code:
@@ -169,6 +168,15 @@ def complete(code, temperature, max_tokens, top_p):
169
  return text, assembled, stats
170
 
171
 
 
 
 
 
 
 
 
 
 
172
  with gr.Blocks(title="RustLean FIM Playground") as demo:
173
  gr.Markdown(
174
  "# 🦀 RustLean — Rust FIM Completion\n"
 
126
  return text.rstrip()
127
 
128
 
129
+ def _complete_impl(code, temperature, max_tokens, top_p):
 
130
  if code.strip() == "":
131
  return "", code, "*Empty input.*"
132
  if CURSOR in code:
 
168
  return text, assembled, stats
169
 
170
 
171
+ @gpu(duration=120)
172
+ def complete(code, temperature, max_tokens, top_p):
173
+ import traceback
174
+ try:
175
+ return _complete_impl(code, temperature, max_tokens, top_p)
176
+ except Exception:
177
+ return "", code, "```\n" + traceback.format_exc() + "\n```"
178
+
179
+
180
  with gr.Blocks(title="RustLean FIM Playground") as demo:
181
  gr.Markdown(
182
  "# 🦀 RustLean — Rust FIM Completion\n"