Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -138,7 +138,7 @@ def retrieve_context(question, contexts):
|
|
138 |
|
139 |
|
140 |
# Define your function to generate answers
|
141 |
-
def generate_answer(question, context):
|
142 |
contexts = chunk_splitter(clean_data(context))
|
143 |
context = retrieve_context(question, contexts)
|
144 |
|
@@ -164,7 +164,7 @@ def generate_answer(question, context):
|
|
164 |
# Paraphrase answer
|
165 |
paraphrased_answer = paraphrase_answer(question, generated_answer)
|
166 |
|
167 |
-
return generated_answer, context, paraphrased_answer
|
168 |
|
169 |
|
170 |
# Define a function to list examples from the dataset
|
@@ -183,12 +183,14 @@ iface = gr.Interface(
|
|
183 |
fn=generate_answer,
|
184 |
inputs=[
|
185 |
Textbox(label="Question"),
|
186 |
-
Textbox(label="Context")
|
|
|
187 |
],
|
188 |
outputs=[
|
189 |
Textbox(label="Generated Answer"),
|
190 |
Textbox(label="Retrieved Context"),
|
191 |
-
Textbox(label="Natural Answer")
|
|
|
192 |
],
|
193 |
examples=list_examples()
|
194 |
)
|
|
|
138 |
|
139 |
|
140 |
# Define your function to generate answers
|
141 |
+
def generate_answer(question, context, ground):
|
142 |
contexts = chunk_splitter(clean_data(context))
|
143 |
context = retrieve_context(question, contexts)
|
144 |
|
|
|
164 |
# Paraphrase answer
|
165 |
paraphrased_answer = paraphrase_answer(question, generated_answer)
|
166 |
|
167 |
+
return generated_answer, context, paraphrased_answer, ground
|
168 |
|
169 |
|
170 |
# Define a function to list examples from the dataset
|
|
|
183 |
fn=generate_answer,
|
184 |
inputs=[
|
185 |
Textbox(label="Question"),
|
186 |
+
Textbox(label="Context"),
|
187 |
+
Textbox(label="Ground truth")
|
188 |
],
|
189 |
outputs=[
|
190 |
Textbox(label="Generated Answer"),
|
191 |
Textbox(label="Retrieved Context"),
|
192 |
+
Textbox(label="Natural Answer")
|
193 |
+
Textbox(label="Ground Truth"),
|
194 |
],
|
195 |
examples=list_examples()
|
196 |
)
|