SadiaK14 commited on
Commit
eedf2cb
·
verified ·
1 Parent(s): 05baa6b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -46
app.py CHANGED
@@ -8,51 +8,6 @@ from Gradio_UI import GradioUI
8
 
9
  # Custom Tool to fetch datasets related to body parts or imaging types
10
 
11
- # @tool
12
- # def my_custom_tool(arg1: str, arg2: int) -> str:
13
- # """
14
- # Search and retrieve publicly available medical datasets from Hugging Face based on any medical-related keyword.
15
-
16
- # Args:
17
- # arg1: A keyword related to medical data (e.g., 'cancer', 'diabetes', 'CT scan', 'radiology', 'dermoscopy').
18
- # arg2: The maximum number of datasets to retrieve.
19
-
20
- # Returns:
21
- # A list of dataset names matching the search query, or a message stating that no datasets were found
22
- # or that the keyword is not medically relevant.
23
- # """
24
- # try:
25
- # keyword = arg1.strip().lower()
26
- # limit = int(arg2)
27
-
28
- # # ✅ Define a basic list of medically relevant terms
29
- # medical_terms = [
30
- # "skin", "brain", "cancer", "breast cancer", "prostate cancer", "stomach", "tumor", "mri", "ct", "xray", "ultrasound",
31
- # "diabetes", "pneumonia", "covid", "lesion", "radiology", "pathology",
32
- # "lung", "chest", "abdomen", "spine", "bone", "stroke", "eczema", "melanoma",
33
- # "eye", "retina", "dermoscopy", "cardiology", "infection", "biopsy", "tooth",
34
- # "toothache", "dental", "ear", "wrist", "hand", "leg", "arm", "heart"
35
- # ]
36
-
37
- # # ✅ Check if the keyword looks medically relevant
38
- # if not any(term in keyword for term in medical_terms):
39
- # return f"'{arg1}' does not appear to be a medical term."
40
-
41
- # # ✅ Proceed to fetch datasets
42
- # response = requests.get(
43
- # f"https://huggingface.co/api/datasets?search={keyword}&limit={limit}"
44
- # )
45
- # response.raise_for_status()
46
- # datasets = response.json()
47
-
48
- # if not datasets:
49
- # return f"No medical datasets found for '{arg1}'."
50
-
51
- # results = [f"- {ds.get('id', 'Unknown')}" for ds in datasets[:limit]]
52
- # return f"Medical datasets related to '{arg1}':\n" + "\n".join(results)
53
-
54
- # except Exception as e:
55
- # return f"Error searching medical datasets for '{arg1}': {str(e)}"
56
  @tool
57
  def my_custom_tool(arg1: str, arg2: int) -> str:
58
  """
@@ -80,6 +35,7 @@ def my_custom_tool(arg1: str, arg2: int) -> str:
80
  "cancer", "tumor", "stroke", "diabetes", "pneumonia", "covid", "asthma", "eczema", "melanoma",
81
  "hypertension", "alzheimer", "parkinson", "arthritis", "scoliosis", "epilepsy", "glaucoma",
82
  "ulcer", "hepatitis", "leukemia", "lymphoma", "tuberculosis", "anemia", "obesity", "depression",
 
83
 
84
  # Imaging Modalities
85
  "mri", "ct", "xray", "x-ray", "ultrasound", "pet", "fmri", "mammo", "angiography", "radiography",
@@ -88,6 +44,7 @@ def my_custom_tool(arg1: str, arg2: int) -> str:
88
  # Medical Specialties
89
  "radiology", "pathology", "oncology", "cardiology", "neurology", "dermatology", "dentistry",
90
  "ophthalmology", "urology", "orthopedics", "gastroenterology", "pulmonology", "nephrology",
 
91
 
92
  # Symptoms / Signs
93
  "lesion", "infection", "fever", "pain", "inflammation", "rash", "headache", "swelling",
@@ -95,7 +52,30 @@ def my_custom_tool(arg1: str, arg2: int) -> str:
95
 
96
  # Common Specific Diseases
97
  "breast cancer", "prostate cancer", "lung cancer", "skin cancer", "colon cancer",
98
- "brain tumor", "liver cancer", "cervical cancer", "bladder cancer", "thyroid cancer"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  ]
100
 
101
 
 
8
 
9
  # Custom Tool to fetch datasets related to body parts or imaging types
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  @tool
12
  def my_custom_tool(arg1: str, arg2: int) -> str:
13
  """
 
35
  "cancer", "tumor", "stroke", "diabetes", "pneumonia", "covid", "asthma", "eczema", "melanoma",
36
  "hypertension", "alzheimer", "parkinson", "arthritis", "scoliosis", "epilepsy", "glaucoma",
37
  "ulcer", "hepatitis", "leukemia", "lymphoma", "tuberculosis", "anemia", "obesity", "depression",
38
+ "anxiety", "bipolar", "autism", "adhd", "ptsd", "psychosis", "schizophrenia",
39
 
40
  # Imaging Modalities
41
  "mri", "ct", "xray", "x-ray", "ultrasound", "pet", "fmri", "mammo", "angiography", "radiography",
 
44
  # Medical Specialties
45
  "radiology", "pathology", "oncology", "cardiology", "neurology", "dermatology", "dentistry",
46
  "ophthalmology", "urology", "orthopedics", "gastroenterology", "pulmonology", "nephrology",
47
+ "psychiatry", "pediatrics", "geriatrics", "infectious disease",
48
 
49
  # Symptoms / Signs
50
  "lesion", "infection", "fever", "pain", "inflammation", "rash", "headache", "swelling",
 
52
 
53
  # Common Specific Diseases
54
  "breast cancer", "prostate cancer", "lung cancer", "skin cancer", "colon cancer",
55
+ "brain tumor", "liver cancer", "cervical cancer", "bladder cancer", "thyroid cancer",
56
+
57
+ # Procedures / Interventions
58
+ "surgery", "chemotherapy", "radiation", "transplant", "dialysis", "intubation", "stenting",
59
+ "ventilation", "vaccination", "anesthesia", "rehabilitation", "prosthetics", "orthotics",
60
+
61
+ # Lab Tests / Biomarkers
62
+ "blood test", "cbc", "glucose", "hemoglobin", "cholesterol", "biomarker", "urinalysis",
63
+ "pcr", "serology", "antibody", "antigen",
64
+
65
+ # Clinical Settings / Roles
66
+ "icu", "hospital", "emergency", "clinical notes", "nursing", "physician", "patient",
67
+ "medical record", "electronic health record", "ehr", "vitals",
68
+
69
+ # Age-based Terms
70
+ "pediatric", "neonatal", "infant", "child", "adolescent", "geriatrics", "elderly",
71
+
72
+ # Epidemiology / Public Health
73
+ "epidemiology", "prevalence", "incidence", "mortality", "public health", "health disparity",
74
+ "risk factor", "social determinant",
75
+
76
+ # Pharmacology / Medications
77
+ "drug", "medication", "pharmacology", "side effect", "adverse event", "dose", "tablet",
78
+ "vaccine", "clinical trial", "placebo"
79
  ]
80
 
81