Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
|
2 |
from transformers import pipeline
|
3 |
from torch import Tensor
|
4 |
from transformers import AutoTokenizer, AutoModel
|
@@ -23,21 +22,22 @@ checkpoint = "intfloat/multilingual-e5-large"
|
|
23 |
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
|
24 |
model = AutoModel.from_pretrained(checkpoint)
|
25 |
|
26 |
-
demo = gr.Blocks(theme="
|
27 |
with demo:
|
|
|
28 |
gr.Markdown("# Sentence Similarity")
|
29 |
gr.Markdown("### How to use:")
|
30 |
gr.Markdown("- Enter Passage 1 and Passage 2, then press Submit")
|
31 |
gr.Markdown("- Select an example, then press Submit")
|
|
|
32 |
|
33 |
-
|
34 |
-
p_txt2 = gr.Textbox(placeholder="Enter passage 2", label="Passage 2")
|
35 |
-
submit = gr.Button("Submit")
|
36 |
-
o_txt = gr.Textbox(placeholder="Similarity score", lines=1,
|
37 |
-
interactive=False, label="Similarity score (0-1)")
|
38 |
|
39 |
-
|
40 |
-
|
|
|
|
|
|
|
41 |
|
42 |
gr.Examples(
|
43 |
[
|
@@ -56,4 +56,4 @@ with demo:
|
|
56 |
o_txt
|
57 |
)
|
58 |
|
59 |
-
demo.launch()
|
|
|
|
|
1 |
from transformers import pipeline
|
2 |
from torch import Tensor
|
3 |
from transformers import AutoTokenizer, AutoModel
|
|
|
22 |
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
|
23 |
model = AutoModel.from_pretrained(checkpoint)
|
24 |
|
25 |
+
demo = gr.Blocks(theme="freddyaboulton/dracula_revamped")
|
26 |
with demo:
|
27 |
+
|
28 |
gr.Markdown("# Sentence Similarity")
|
29 |
gr.Markdown("### How to use:")
|
30 |
gr.Markdown("- Enter Passage 1 and Passage 2, then press Submit")
|
31 |
gr.Markdown("- Select an example, then press Submit")
|
32 |
+
gr.Markdown("Model: https://huggingface.co/intfloat/multilingual-e5-large (Multilingual: 94 languages)")
|
33 |
|
34 |
+
with gr.Row():
|
|
|
|
|
|
|
|
|
35 |
|
36 |
+
p_txt1 = gr.Textbox(placeholder="Enter passage 1", label="Passage 1", lines=3, scale=2)
|
37 |
+
p_txt2 = gr.Textbox(placeholder="Enter passage 2", label="Passage 2", lines=3, scale=2)
|
38 |
+
o_txt = gr.Textbox(placeholder="Similarity score", lines=1, interactive=False, label="Similarity score (0-1)", scale=1)
|
39 |
+
|
40 |
+
submit = gr.Button("Submit")
|
41 |
|
42 |
gr.Examples(
|
43 |
[
|
|
|
56 |
o_txt
|
57 |
)
|
58 |
|
59 |
+
demo.launch()
|