wakeupmh commited on
Commit
208e459
·
1 Parent(s): 5771d92

fix: prompt

Browse files
Files changed (1) hide show
  1. app.py +14 -15
app.py CHANGED
@@ -82,13 +82,13 @@ class ResearchFetcher:
82
  summary_lower = result.summary.lower()
83
 
84
  if any(term in title_lower or term in summary_lower
85
- for term in ['autism', 'asd']):
86
  papers.append(Paper(
87
  title=result.title,
88
  abstract=result.summary,
89
  url=result.pdf_url,
90
  published=result.published.strftime("%Y-%m-%d"),
91
- relevance_score=1.0 if 'autism' in title_lower else 0.5
92
  ))
93
 
94
  return papers
@@ -121,7 +121,7 @@ class ResearchFetcher:
121
  return []
122
 
123
  # Fetch details in parallel
124
- with ThreadPoolExecutor(max_workers=3) as executor:
125
  paper_futures = [
126
  executor.submit(self._fetch_paper_details, base_url, id_elem.text)
127
  for id_elem in id_list
@@ -209,21 +209,20 @@ class ModelHandler:
209
 
210
  try:
211
  # FLAN-T5 responds better to direct instruction prompts
212
- input_text = f"""Answer the following question about autism using the provided research context.
213
-
214
- Research Context:
215
- {context}
216
 
217
- Question: {question}
 
218
 
219
- Instructions:
220
- - Be specific and evidence-based
221
- - Use clear, accessible language
222
- - Focus on practical implications
223
- - Cite research when relevant
224
- - Be respectful of neurodiversity
 
225
 
226
- Answer:"""
227
 
228
  inputs = self.tokenizer(
229
  input_text,
 
82
  summary_lower = result.summary.lower()
83
 
84
  if any(term in title_lower or term in summary_lower
85
+ for term in ['autism', 'asd', 'autism spectrum disorder']):
86
  papers.append(Paper(
87
  title=result.title,
88
  abstract=result.summary,
89
  url=result.pdf_url,
90
  published=result.published.strftime("%Y-%m-%d"),
91
+ relevance_score=1.0 if 'autism' in title_lower else 0.8
92
  ))
93
 
94
  return papers
 
121
  return []
122
 
123
  # Fetch details in parallel
124
+ with ThreadPoolExecutor(max_workers=2) as executor:
125
  paper_futures = [
126
  executor.submit(self._fetch_paper_details, base_url, id_elem.text)
127
  for id_elem in id_list
 
209
 
210
  try:
211
  # FLAN-T5 responds better to direct instruction prompts
212
+ input_text = f"""You are an expert in autism research. Provide a clear, structured, and evidence-based explanation of autism using the provided research context.
 
 
 
213
 
214
+ Research Context:
215
+ {context}
216
 
217
+ Instructions:
218
+ 1. Start with a concise definition of autism.
219
+ 2. Explain the key characteristics and symptoms.
220
+ 3. Discuss potential causes and contributing factors (e.g., genetic, environmental).
221
+ 4. Mention current research findings and treatments.
222
+ 5. Use clear, accessible language.
223
+ 6. Cite specific studies or papers when relevant.
224
 
225
+ Answer:"""
226
 
227
  inputs = self.tokenizer(
228
  input_text,