Spaces:
Runtime error
Runtime error
Francesco-A
commited on
Commit
•
c88a876
1
Parent(s):
63fefc5
Update app.py
Browse files
app.py
CHANGED
@@ -13,7 +13,8 @@ from sentence_transformers import SentenceTransformer, util
|
|
13 |
s_model = SentenceTransformer('clips/mfaq')
|
14 |
|
15 |
from transformers import pipeline
|
16 |
-
qa_model = pipeline(
|
|
|
17 |
|
18 |
# %% ../drive/MyDrive/Codici/Python/Gradio_App/SemanticSearch_QA-v2.ipynb 3
|
19 |
# Define the question(s)
|
@@ -117,6 +118,14 @@ def QA_similarity(question, contexts, n_answers=1):
|
|
117 |
return df
|
118 |
|
119 |
# %% ../drive/MyDrive/Codici/Python/Gradio_App/SemanticSearch_QA-v2.ipynb 6
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
data = {
|
121 |
'Context': contexts,
|
122 |
}
|
@@ -133,8 +142,11 @@ intf = gr.Interface(fn=QA_similarity,
|
|
133 |
[question_2,context_df,5],
|
134 |
[question_4,context_df,10]],
|
135 |
debug=True,
|
|
|
|
|
|
|
136 |
)
|
137 |
|
138 |
intf.launch(inline=True,
|
139 |
# share=True
|
140 |
-
)
|
|
|
13 |
s_model = SentenceTransformer('clips/mfaq')
|
14 |
|
15 |
from transformers import pipeline
|
16 |
+
qa_model = pipeline(task = 'question-answering',
|
17 |
+
model = 'Francesco-A/bert-finetuned-squad-v1')
|
18 |
|
19 |
# %% ../drive/MyDrive/Codici/Python/Gradio_App/SemanticSearch_QA-v2.ipynb 3
|
20 |
# Define the question(s)
|
|
|
118 |
return df
|
119 |
|
120 |
# %% ../drive/MyDrive/Codici/Python/Gradio_App/SemanticSearch_QA-v2.ipynb 6
|
121 |
+
#|export
|
122 |
+
|
123 |
+
title = 'SemanticSearch_QA-v2'
|
124 |
+
description = """
|
125 |
+
FAQ retrieval model: [clips/mfaq](https://huggingface.co/clips/mfaq) \n
|
126 |
+
QA model: [Francesco-A/bert-finetuned-squad-v1](https://huggingface.co/Francesco-A/bert-finetuned-squad-v1)
|
127 |
+
"""
|
128 |
+
|
129 |
data = {
|
130 |
'Context': contexts,
|
131 |
}
|
|
|
142 |
[question_2,context_df,5],
|
143 |
[question_4,context_df,10]],
|
144 |
debug=True,
|
145 |
+
title=title,
|
146 |
+
description=description,
|
147 |
+
# article=long_desc
|
148 |
)
|
149 |
|
150 |
intf.launch(inline=True,
|
151 |
# share=True
|
152 |
+
)
|