Shirjannn commited on
Commit
a483276
·
verified ·
1 Parent(s): a502e92

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -17
app.py CHANGED
@@ -34,26 +34,12 @@ def build_dataset():
34
 
35
  derma_examples = []
36
  for item in derma:
37
- q = item.get('question') or item.get('Question') or item.get('Q')
38
- a = item.get('answer') or item.get('Answer') or item.get('A')
39
  if q and a:
40
  derma_examples.append({"domain":"dermatology","context":q,"response":a})
41
 
42
- # ----- MedQuAD subset
43
- print("Loading MedQuAD subset...")
44
- medquad = load_dataset("pythonafroz/MedQuAD")['train']
45
- derma_keywords = ["skin", "eczema", "psoriasis", "dermatitis", "melanoma", "acne", "rash"]
46
- medquad_derma = [{"domain":"dermatology",
47
- "context":item['question'],
48
- "response":item['answer']}
49
- for item in medquad if any(k in item['question'].lower() for k in derma_keywords)]
50
- random.shuffle(medquad_derma)
51
- medquad_derma = medquad_derma[:500]
52
-
53
- dermatology_examples = derma_examples + medquad_derma
54
- random.shuffle(dermatology_examples)
55
-
56
- all_examples = general_examples + dermatology_examples
57
  random.shuffle(all_examples)
58
 
59
  # ذخیره به JSONL
 
34
 
35
  derma_examples = []
36
  for item in derma:
37
+ q = item.get('prompt') # Mreeb uses 'prompt' instead of 'question'
38
+ a = item.get('response')
39
  if q and a:
40
  derma_examples.append({"domain":"dermatology","context":q,"response":a})
41
 
42
+ all_examples = general_examples + derma_examples
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  random.shuffle(all_examples)
44
 
45
  # ذخیره به JSONL