Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -144,11 +144,11 @@ def retrieve_context(question, contexts):
|
|
144 |
# Define your function to generate answers
|
145 |
def generate_answer(question, context, ground, do_pretrained, do_natural, do_pretrained_natural):
|
146 |
contexts = chunk_splitter(clean_data(context))
|
147 |
-
|
148 |
-
ground_in_context = ground in
|
149 |
|
150 |
# Combine question and context
|
151 |
-
input_text = f"question: {question} context: {
|
152 |
|
153 |
# Tokenize the input text
|
154 |
input_ids = tokenizer(
|
@@ -183,7 +183,7 @@ def generate_answer(question, context, ground, do_pretrained, do_natural, do_pre
|
|
183 |
if do_pretrained_natural:
|
184 |
pretrained_paraphrased_answer = paraphrase_answer(question, generated_answer, True)
|
185 |
|
186 |
-
return generated_answer, paraphrased_answer, ground_in_context, pretrained_answer, pretrained_paraphrased_answer,
|
187 |
|
188 |
|
189 |
# Define a function to list examples from the dataset
|
|
|
144 |
# Define your function to generate answers
|
145 |
def generate_answer(question, context, ground, do_pretrained, do_natural, do_pretrained_natural):
|
146 |
contexts = chunk_splitter(clean_data(context))
|
147 |
+
retrieved_context = retrieve_context(question, contexts)
|
148 |
+
ground_in_context = ground in retrieved_context
|
149 |
|
150 |
# Combine question and context
|
151 |
+
input_text = f"question: {question} context: {retrieved_context}"
|
152 |
|
153 |
# Tokenize the input text
|
154 |
input_ids = tokenizer(
|
|
|
183 |
if do_pretrained_natural:
|
184 |
pretrained_paraphrased_answer = paraphrase_answer(question, generated_answer, True)
|
185 |
|
186 |
+
return generated_answer, paraphrased_answer, ground_in_context, pretrained_answer, pretrained_paraphrased_answer, retrieved_context
|
187 |
|
188 |
|
189 |
# Define a function to list examples from the dataset
|