Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -40,10 +40,15 @@ def generate_response(model, tokenizer, prompt, max_length=512, num_return_seque
|
|
40 |
|
41 |
# Define a função para responder às perguntas
|
42 |
def answer_question(context, question):
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
47 |
return generate_response(model, tokenizer, prompt)
|
48 |
|
49 |
|
|
|
40 |
|
41 |
# Define a função para responder às perguntas
|
42 |
def answer_question(context, question):
|
43 |
+
prompt = f"""Com base no contexto fornecido, responda a questão de forma sucinta.
|
44 |
+
Contexto:
|
45 |
+
{context}
|
46 |
+
Questão:
|
47 |
+
{question}
|
48 |
+
### Resposta:
|
49 |
+
"""
|
50 |
+
#else:
|
51 |
+
#prompt = f"Questão:\n{question}\n### Resposta:"
|
52 |
return generate_response(model, tokenizer, prompt)
|
53 |
|
54 |
|