Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -6,18 +6,15 @@ from tqdm.auto import tqdm
|
|
6 |
import os
|
7 |
|
8 |
|
9 |
-
|
10 |
-
#
|
11 |
css = """
|
12 |
-
/*
|
13 |
-
|
14 |
-
You can remove or comment out any previous .share-button CSS if it was there.
|
15 |
*/
|
16 |
"""
|
17 |
|
18 |
|
19 |
-
|
20 |
-
|
21 |
# --- Model Loading ---
|
22 |
tokenizer_splade = None
|
23 |
model_splade = None
|
@@ -441,13 +438,7 @@ with gr.Blocks(title="SPLADE Demos", css=css) as demo:
|
|
441 |
label="Enter your query or document text here:",
|
442 |
placeholder="e.g., Why is Padua the nicest city in Italy?"
|
443 |
)
|
444 |
-
#
|
445 |
-
gr.ShareButton(
|
446 |
-
value="Share My Sparse Representation",
|
447 |
-
components=[input_text, model_radio], # You can specify components to share
|
448 |
-
visible=True # Make sure it's visible
|
449 |
-
)
|
450 |
-
# --- End New ---
|
451 |
info_output_display = gr.Markdown(
|
452 |
value="",
|
453 |
label="Vector Information",
|
@@ -474,7 +465,7 @@ with gr.Blocks(title="SPLADE Demos", css=css) as demo:
|
|
474 |
outputs=[main_representation_output, info_output_display]
|
475 |
)
|
476 |
|
477 |
-
with gr.TabItem("Compare Encoders"): #
|
478 |
gr.Markdown("### Calculate Dot Product Similarity Between Encoded Query and Document")
|
479 |
|
480 |
# Define the common model choices for cleaner code
|
@@ -512,4 +503,5 @@ with gr.Blocks(title="SPLADE Demos", css=css) as demo:
|
|
512 |
allow_flagging="never" # Keep this to keep the share button at the bottom of THIS interface
|
513 |
)
|
514 |
|
515 |
-
demo
|
|
|
|
6 |
import os
|
7 |
|
8 |
|
9 |
+
# Remove or comment out any CSS related to .share-button if you want Gradio to handle its default placement.
|
10 |
+
# If you *still* want it fixed to a specific corner globally, you can uncomment your original fixed CSS.
|
11 |
css = """
|
12 |
+
/* No specific CSS for .share-button if we're letting Gradio place it dynamically
|
13 |
+
when demo.launch(share=True) is used.
|
|
|
14 |
*/
|
15 |
"""
|
16 |
|
17 |
|
|
|
|
|
18 |
# --- Model Loading ---
|
19 |
tokenizer_splade = None
|
20 |
model_splade = None
|
|
|
438 |
label="Enter your query or document text here:",
|
439 |
placeholder="e.g., Why is Padua the nicest city in Italy?"
|
440 |
)
|
441 |
+
# Removed gr.ShareButton here as it caused an AttributeError
|
|
|
|
|
|
|
|
|
|
|
|
|
442 |
info_output_display = gr.Markdown(
|
443 |
value="",
|
444 |
label="Vector Information",
|
|
|
465 |
outputs=[main_representation_output, info_output_display]
|
466 |
)
|
467 |
|
468 |
+
with gr.TabItem("Compare Encoders"): # This is the tab we are focusing on
|
469 |
gr.Markdown("### Calculate Dot Product Similarity Between Encoded Query and Document")
|
470 |
|
471 |
# Define the common model choices for cleaner code
|
|
|
503 |
allow_flagging="never" # Keep this to keep the share button at the bottom of THIS interface
|
504 |
)
|
505 |
|
506 |
+
# Crucial step: Launch the demo with share=True
|
507 |
+
demo.launch(share=True)
|