Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -436,6 +436,10 @@ def build_interface():
|
|
436 |
lines=2,
|
437 |
placeholder="Enter text to see tokenization..."
|
438 |
)
|
|
|
|
|
|
|
|
|
439 |
inspect_btn = gr.Button("π Inspect Tokens")
|
440 |
|
441 |
with gr.Column():
|
@@ -445,6 +449,25 @@ def build_interface():
|
|
445 |
info="Shows how text is tokenized with position indices"
|
446 |
)
|
447 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
448 |
# Event handlers
|
449 |
analyze_btn.click(
|
450 |
symbolic_classification_analysis,
|
@@ -458,6 +481,9 @@ def build_interface():
|
|
458 |
outputs=[manual_results, manual_summary, manual_count]
|
459 |
)
|
460 |
|
|
|
|
|
|
|
461 |
def inspect_tokens(text):
|
462 |
if not text.strip():
|
463 |
return "Enter text to inspect tokenization"
|
@@ -470,6 +496,12 @@ def build_interface():
|
|
470 |
|
471 |
return "\n".join(result_lines)
|
472 |
|
|
|
|
|
|
|
|
|
|
|
|
|
473 |
inspect_btn.click(
|
474 |
inspect_tokens,
|
475 |
inputs=[inspect_text],
|
|
|
436 |
lines=2,
|
437 |
placeholder="Enter text to see tokenization..."
|
438 |
)
|
439 |
+
|
440 |
+
# Add example patterns button
|
441 |
+
example_patterns = gr.Button("π Load Image Caption Examples")
|
442 |
+
|
443 |
inspect_btn = gr.Button("π Inspect Tokens")
|
444 |
|
445 |
with gr.Column():
|
|
|
449 |
info="Shows how text is tokenized with position indices"
|
450 |
)
|
451 |
|
452 |
+
with gr.Tab("Caption Examples"):
|
453 |
+
gr.Markdown("### πΌοΈ Test with Realistic Image Caption Patterns")
|
454 |
+
|
455 |
+
example_captions = [
|
456 |
+
"a young woman wearing a blue dress",
|
457 |
+
"the man has short brown hair",
|
458 |
+
"she is wearing red high heels",
|
459 |
+
"the lighting is soft and natural",
|
460 |
+
"her expression shows happiness",
|
461 |
+
"a person standing in confident pose",
|
462 |
+
"wearing elegant silver jewelry",
|
463 |
+
"the fabric has floral pattern"
|
464 |
+
]
|
465 |
+
|
466 |
+
for caption in example_captions:
|
467 |
+
with gr.Row():
|
468 |
+
gr.Textbox(value=caption, label="Example Caption", interactive=False, scale=3)
|
469 |
+
copy_btn = gr.Button("π Copy", scale=1)
|
470 |
+
|
471 |
# Event handlers
|
472 |
analyze_btn.click(
|
473 |
symbolic_classification_analysis,
|
|
|
481 |
outputs=[manual_results, manual_summary, manual_count]
|
482 |
)
|
483 |
|
484 |
+
def load_examples():
|
485 |
+
return "a young woman wearing a blue dress"
|
486 |
+
|
487 |
def inspect_tokens(text):
|
488 |
if not text.strip():
|
489 |
return "Enter text to inspect tokenization"
|
|
|
496 |
|
497 |
return "\n".join(result_lines)
|
498 |
|
499 |
+
# Event handlers
|
500 |
+
example_patterns.click(
|
501 |
+
load_examples,
|
502 |
+
outputs=[inspect_text]
|
503 |
+
)
|
504 |
+
|
505 |
inspect_btn.click(
|
506 |
inspect_tokens,
|
507 |
inputs=[inspect_text],
|