wakeupmh commited on
Commit
67c9f69
·
1 Parent(s): 8741970

fix: prompt

Browse files
Files changed (1) hide show
  1. app.py +15 -25
app.py CHANGED
@@ -208,19 +208,20 @@ def generate_answer(question, context, max_length=512):
208
  clean_question = clean_text(question)
209
 
210
  # Format the input for T5 (it expects a specific format)
211
- input_text = f"""Generate a comprehensive answer about autism that combines general knowledge with specific research findings.
212
 
213
  Question: {clean_question}
214
 
215
- Recent Research:
216
  {clean_context}
217
 
218
- Instructions: Create a response that:
219
- 1. Starts with a general explanation about the topic
220
- 2. Then adds specific findings from the research papers to support or expand the explanation
221
- 3. Focuses on being helpful and informative for someone wanting to understand autism
 
222
 
223
- Answer in Portuguese, combining general knowledge with research findings."""
224
 
225
  try:
226
  # T5 expects a specific format for the input
@@ -251,26 +252,15 @@ Answer in Portuguese, combining general knowledge with research findings."""
251
 
252
  # If response is too short or empty, provide a general overview
253
  if len(response.strip()) < 100:
254
- return """### CONHECIMENTO GERAL ###
255
- O Transtorno do Espectro do Autismo (TEA) é uma condição do neurodesenvolvimento que afeta a forma como uma pessoa percebe e interage com o mundo. O TEA engloba diferentes condições anteriormente separadas, incluindo:
256
- - Autismo Infantil Precoce
257
- - Autismo de Kanner
258
- - Autismo de Alto Funcionamento
259
- - Síndrome de Asperger
260
- - Transtorno Global do Desenvolvimento sem outra especificação
261
 
262
- Características principais:
263
- 1. Comunicação e interação social
264
- 2. Padrões repetitivos de comportamento
265
- 3. Interesses específicos e intensos
266
- 4. Sensibilidade sensorial
267
 
268
- ### PESQUISAS RECENTES ###
269
- As pesquisas atuais não forneceram informações específicas sobre este aspecto do autismo. Para obter informações baseadas em pesquisas recentes, tente fazer uma pergunta mais específica sobre:
270
- - Causas genéticas e ambientais
271
- - Métodos de intervenção precoce
272
- - Tratamentos e terapias
273
- - Desenvolvimento neurológico"""
274
 
275
  # Format the response for better readability
276
  formatted_response = response.replace(". ", ".\n").replace("• ", "\n• ")
 
208
  clean_question = clean_text(question)
209
 
210
  # Format the input for T5 (it expects a specific format)
211
+ input_text = f"""Generate a comprehensive answer about autism, using the research papers as references to support your explanations.
212
 
213
  Question: {clean_question}
214
 
215
+ Research Papers:
216
  {clean_context}
217
 
218
+ Instructions:
219
+ 1. Provide a general explanation about the topic
220
+ 2. Use the research papers as references, citing them in the format "According to [PAPER TITLE], ..."
221
+ 3. Integrate research findings naturally into the explanation
222
+ 4. Keep the focus on being informative and helpful
223
 
224
+ Answer in a clear, informative way, using the papers as references."""
225
 
226
  try:
227
  # T5 expects a specific format for the input
 
252
 
253
  # If response is too short or empty, provide a general overview
254
  if len(response.strip()) < 100:
255
+ return """Autism Spectrum Disorder (ASD) is a complex neurodevelopmental condition. Unfortunately, the provided papers don't contain specific information about this aspect of autism.
 
 
 
 
 
 
256
 
257
+ To get research-based information, try asking more specific questions about:
258
+ - Genetics and environmental factors
259
+ - Early intervention
260
+ - Treatments and therapies
261
+ - Neurological development
262
 
263
+ This will allow us to provide accurate information supported by recent scientific research."""
 
 
 
 
 
264
 
265
  # Format the response for better readability
266
  formatted_response = response.replace(". ", ".\n").replace("• ", "\n• ")