Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -574,17 +574,29 @@ with gr.Blocks(title="SPLADE Demos", css=css) as demo:
|
|
| 574 |
placeholder="e.g., Padua's cuisine is as famous as its legendary University."
|
| 575 |
)
|
| 576 |
|
| 577 |
-
# --- MODIFIED: Output component as a
|
| 578 |
-
|
| 579 |
-
|
| 580 |
-
|
| 581 |
-
|
| 582 |
-
|
| 583 |
-
|
| 584 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 585 |
)
|
| 586 |
|
| 587 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 588 |
gr.Interface(
|
| 589 |
fn=calculate_dot_product_and_representations_independent,
|
| 590 |
inputs=[
|
|
@@ -593,7 +605,7 @@ with gr.Blocks(title="SPLADE Demos", css=css) as demo:
|
|
| 593 |
query_text_input,
|
| 594 |
doc_text_input
|
| 595 |
],
|
| 596 |
-
outputs=
|
| 597 |
allow_flagging="never"
|
| 598 |
)
|
| 599 |
|
|
|
|
| 574 |
placeholder="e.g., Padua's cuisine is as famous as its legendary University."
|
| 575 |
)
|
| 576 |
|
| 577 |
+
# --- MODIFIED: Output component as a gr.Markdown with scrolling ---
|
| 578 |
+
# Reverting to gr.Markdown, and adding height/scroll for it
|
| 579 |
+
output_dot_product_markdown = gr.Markdown(
|
| 580 |
+
# Use value="" to initialize, content will be set by the function
|
| 581 |
+
value="",
|
| 582 |
+
# Fixed height for the scrollable area
|
| 583 |
+
# You can adjust this value (e.g., "500px") to your preference
|
| 584 |
+
# Or set it as a percentage of available space, e.g., "80%"
|
| 585 |
+
height=500, # Example: 500 pixels height
|
| 586 |
+
# Enable vertical scrolling if content overflows
|
| 587 |
+
# "auto" is often good, "scroll" always shows scrollbar
|
| 588 |
+
# Gradio uses `css` for this, so these parameters might translate to inline styles
|
| 589 |
+
# or custom CSS classes automatically added by Gradio.
|
| 590 |
+
elem_classes=["scrollable-output"] # Add a custom class for CSS targeting if needed
|
| 591 |
)
|
| 592 |
|
| 593 |
+
# Add CSS specifically for this scrollable markdown output
|
| 594 |
+
# This needs to be added to the overall `css` string or handled directly here
|
| 595 |
+
# For simplicity, let's assume `height` itself will enable scroll in newer Gradio,
|
| 596 |
+
# or add a specific CSS class targeting the markdown.
|
| 597 |
+
# However, for pure markdown, `height` is the primary way.
|
| 598 |
+
|
| 599 |
+
# Update the gr.Interface call to use the new Markdown output
|
| 600 |
gr.Interface(
|
| 601 |
fn=calculate_dot_product_and_representations_independent,
|
| 602 |
inputs=[
|
|
|
|
| 605 |
query_text_input,
|
| 606 |
doc_text_input
|
| 607 |
],
|
| 608 |
+
outputs=output_dot_product_markdown, # Changed back to Markdown
|
| 609 |
allow_flagging="never"
|
| 610 |
)
|
| 611 |
|