Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ import pandas as pd
|
|
5 |
reranker = CrossEncoder("sentence-transformers/all-MiniLM-L12-v2")
|
6 |
|
7 |
|
8 |
-
def
|
9 |
documents = documents.copy()
|
10 |
documents = documents.drop_duplicates("text")
|
11 |
documents["rank"] = reranker.predict([[query, hit] for hit in documents["text"]])
|
@@ -33,7 +33,7 @@ with gr.Blocks() as demo:
|
|
33 |
)
|
34 |
|
35 |
submit_btn.click(
|
36 |
-
fn=
|
37 |
inputs=[query_input, documents_input],
|
38 |
outputs=[documents_output],
|
39 |
)
|
|
|
5 |
reranker = CrossEncoder("sentence-transformers/all-MiniLM-L12-v2")
|
6 |
|
7 |
|
8 |
+
def rerank(query: str, documents: pd.DataFrame) -> pd.DataFrame:
|
9 |
documents = documents.copy()
|
10 |
documents = documents.drop_duplicates("text")
|
11 |
documents["rank"] = reranker.predict([[query, hit] for hit in documents["text"]])
|
|
|
33 |
)
|
34 |
|
35 |
submit_btn.click(
|
36 |
+
fn=rerank,
|
37 |
inputs=[query_input, documents_input],
|
38 |
outputs=[documents_output],
|
39 |
)
|