Jellyfish042 commited on
Commit
820f694
·
1 Parent(s): 8a0d82d
Files changed (1) hide show
  1. app.py +7 -29
app.py CHANGED
@@ -267,24 +267,7 @@ def run_evaluation(text: str, progress=gr.Progress()):
267
  # Wrap HTML for iframe display
268
  wrapped_html = wrap_html_in_iframe(html)
269
 
270
- # Generate timing information for UI display
271
- timing_lines = ["## ⏱️ Inference Timing\n"]
272
-
273
- # Qwen timing
274
- if qwen_predicted_time is not None:
275
- timing_lines.append(f"**Qwen3-1.7B-Base**: {result_qwen['inference_time']:.2f}s (predicted: {qwen_predicted_time:.2f}s)")
276
- else:
277
- timing_lines.append(f"**Qwen3-1.7B-Base**: {result_qwen['inference_time']:.2f}s")
278
-
279
- # RWKV timing
280
- if rwkv_predicted_time is not None:
281
- timing_lines.append(f"**RWKV7-G1C-1.5B**: {result_rwkv['inference_time']:.2f}s (predicted: {rwkv_predicted_time:.2f}s)")
282
- else:
283
- timing_lines.append(f"**RWKV7-G1C-1.5B**: {result_rwkv['inference_time']:.2f}s")
284
-
285
- timing_text = "\n\n".join(timing_lines)
286
-
287
- return wrapped_html, timing_text
288
 
289
  except torch.cuda.OutOfMemoryError:
290
  if torch.cuda.is_available():
@@ -300,7 +283,7 @@ def run_evaluation(text: str, progress=gr.Progress()):
300
 
301
  def clear_inputs():
302
  """Clear all inputs and outputs."""
303
- return "", None, ""
304
 
305
 
306
  def get_default_example():
@@ -309,9 +292,9 @@ def get_default_example():
309
 
310
  if _precomputed_html and _precomputed_text:
311
  wrapped_html = wrap_html_in_iframe(_precomputed_html)
312
- return _precomputed_text, wrapped_html, ""
313
  else:
314
- return "", None, ""
315
 
316
 
317
  # Build Gradio UI
@@ -338,22 +321,17 @@ with gr.Blocks(title="Compression-Lens: RWKV-7 vs Qwen3", theme=gr.themes.Soft()
338
 
339
  gr.Markdown("---")
340
 
341
- # Timing information display
342
- with gr.Row():
343
- with gr.Column():
344
- timing_info = gr.Markdown(label="Inference Timing")
345
-
346
  with gr.Row():
347
  with gr.Column():
348
  output_html = gr.HTML(label="Visualization")
349
 
350
  # Event handlers
351
- clear_btn.click(fn=clear_inputs, outputs=[text_input, output_html, timing_info])
352
 
353
- run_btn.click(fn=run_evaluation, inputs=[text_input], outputs=[output_html, timing_info])
354
 
355
  # Load default example on page load
356
- demo.load(fn=get_default_example, outputs=[text_input, output_html, timing_info])
357
 
358
 
359
  if __name__ == "__main__":
 
267
  # Wrap HTML for iframe display
268
  wrapped_html = wrap_html_in_iframe(html)
269
 
270
+ return wrapped_html
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
271
 
272
  except torch.cuda.OutOfMemoryError:
273
  if torch.cuda.is_available():
 
283
 
284
  def clear_inputs():
285
  """Clear all inputs and outputs."""
286
+ return "", None
287
 
288
 
289
  def get_default_example():
 
292
 
293
  if _precomputed_html and _precomputed_text:
294
  wrapped_html = wrap_html_in_iframe(_precomputed_html)
295
+ return _precomputed_text, wrapped_html
296
  else:
297
+ return "", None
298
 
299
 
300
  # Build Gradio UI
 
321
 
322
  gr.Markdown("---")
323
 
 
 
 
 
 
324
  with gr.Row():
325
  with gr.Column():
326
  output_html = gr.HTML(label="Visualization")
327
 
328
  # Event handlers
329
+ clear_btn.click(fn=clear_inputs, outputs=[text_input, output_html])
330
 
331
+ run_btn.click(fn=run_evaluation, inputs=[text_input], outputs=[output_html])
332
 
333
  # Load default example on page load
334
+ demo.load(fn=get_default_example, outputs=[text_input, output_html])
335
 
336
 
337
  if __name__ == "__main__":