Spaces:
Runtime error
Runtime error
Commit
·
9d17108
1
Parent(s):
be75c7f
app logs
Browse files
app.py
CHANGED
@@ -109,8 +109,8 @@ def generate_question_from_prompt(theme, difficulty, example_question=None):
|
|
109 |
def generate_simulado():
|
110 |
logger.info("Iniciando geração de simulado...")
|
111 |
|
112 |
-
# Exibe as
|
113 |
-
max_json_questions = min(
|
114 |
for i in range(max_json_questions):
|
115 |
question_data = examples[i]
|
116 |
logger.info(f"Questão do JSON {i + 1}: {question_data['question']}")
|
@@ -119,8 +119,8 @@ def generate_simulado():
|
|
119 |
logger.info(f" Gabarito: {question_data['answer']}")
|
120 |
logger.info(f" Explicação: {question_data['explanation']}")
|
121 |
|
122 |
-
# Gera
|
123 |
-
for i in range(
|
124 |
logger.debug(f"Gerando pergunta adicional {i + 1}")
|
125 |
example = examples[i % len(examples)] if examples else None
|
126 |
question_data = generate_question_from_prompt("clinica medica", "medio", example)
|
@@ -131,7 +131,7 @@ def generate_simulado():
|
|
131 |
logger.info(f" Explicação: {question_data['explanation']}")
|
132 |
|
133 |
logger.info("Geração de simulado concluída.")
|
134 |
-
return {"simulado": examples[:
|
135 |
|
136 |
# Força carregamento inicial
|
137 |
logger.info("Testando carregamento inicial do modelo...")
|
@@ -153,9 +153,9 @@ async def generate_question(theme: str, difficulty: str):
|
|
153 |
return generate_question_from_prompt(theme, difficulty, example)
|
154 |
|
155 |
@app.get("/simulado")
|
156 |
-
async def get_simulado(num_questions: int =
|
157 |
-
simulado = examples[:min(
|
158 |
-
for _ in range(min(
|
159 |
example = examples[0] if examples else None
|
160 |
question_data = generate_question_from_prompt("clinica medica", "medio", example)
|
161 |
simulado.append(question_data)
|
|
|
109 |
def generate_simulado():
|
110 |
logger.info("Iniciando geração de simulado...")
|
111 |
|
112 |
+
# Exibe as 3 primeiras perguntas do JSON
|
113 |
+
max_json_questions = min(3, len(examples))
|
114 |
for i in range(max_json_questions):
|
115 |
question_data = examples[i]
|
116 |
logger.info(f"Questão do JSON {i + 1}: {question_data['question']}")
|
|
|
119 |
logger.info(f" Gabarito: {question_data['answer']}")
|
120 |
logger.info(f" Explicação: {question_data['explanation']}")
|
121 |
|
122 |
+
# Gera 3 perguntas adicionais com o modelo
|
123 |
+
for i in range(3):
|
124 |
logger.debug(f"Gerando pergunta adicional {i + 1}")
|
125 |
example = examples[i % len(examples)] if examples else None
|
126 |
question_data = generate_question_from_prompt("clinica medica", "medio", example)
|
|
|
131 |
logger.info(f" Explicação: {question_data['explanation']}")
|
132 |
|
133 |
logger.info("Geração de simulado concluída.")
|
134 |
+
return {"simulado": examples[:3] + [generate_question_from_prompt("clinica medica", "medio") for _ in range(3)]}
|
135 |
|
136 |
# Força carregamento inicial
|
137 |
logger.info("Testando carregamento inicial do modelo...")
|
|
|
153 |
return generate_question_from_prompt(theme, difficulty, example)
|
154 |
|
155 |
@app.get("/simulado")
|
156 |
+
async def get_simulado(num_questions: int = 6): # 3 do JSON + 3 geradas
|
157 |
+
simulado = examples[:min(3, len(examples))] # Até 3 do JSON
|
158 |
+
for _ in range(min(3, num_questions - len(simulado))): # Gera até 3 adicionais
|
159 |
example = examples[0] if examples else None
|
160 |
question_data = generate_question_from_prompt("clinica medica", "medio", example)
|
161 |
simulado.append(question_data)
|