plutoa386 commited on
Commit
c736f26
·
1 Parent(s): a7555f1

updated api endpoint names

Browse files
Files changed (2) hide show
  1. app.py +7 -5
  2. crew.py +8 -3
app.py CHANGED
@@ -49,7 +49,7 @@ with gr.Blocks() as demo:
49
  gr.Markdown("# 🧠 NMS Dementia Risk Assessment API - Development Zone")
50
 
51
  with gr.Tabs():
52
- # ====== Predictions Tab ======
53
  with gr.Tab("Predictions"):
54
  gr.Markdown("### 🔮 Risk Assessment (Lifestyle or Audio)")
55
  mode_pred = gr.Radio(
@@ -58,7 +58,7 @@ with gr.Blocks() as demo:
58
  label="Assessment Type"
59
  )
60
  doc_id_pred = gr.Textbox(
61
- label="Patient Document ID",
62
  placeholder="e.g., umWSG13rLSfHqqJlq1WluPzjLB93"
63
  )
64
  output_pred = gr.JSON()
@@ -69,20 +69,22 @@ with gr.Blocks() as demo:
69
  outputs=output_pred
70
  )
71
 
72
- # ====== News Tab ======
73
  with gr.Tab("News"):
74
  gr.Markdown("### 📰 Dementia News for Different Audiences")
75
  mode_news = gr.Radio(
76
  choices=["patientnews", "doctornews"],
77
  value="patientnews",
78
- label="News Audience"
 
79
  )
80
  output_news = gr.JSON()
81
  btn_news = gr.Button("Fetch News")
82
  btn_news.click(
83
  fn=lambda mode: news_patient() if mode == "patientnews" else news_doctor(),
84
  inputs=[mode_news],
85
- outputs=output_news
 
86
  )
87
 
88
  demo.launch()
 
49
  gr.Markdown("# 🧠 NMS Dementia Risk Assessment API - Development Zone")
50
 
51
  with gr.Tabs():
52
+ # Predictions Tab
53
  with gr.Tab("Predictions"):
54
  gr.Markdown("### 🔮 Risk Assessment (Lifestyle or Audio)")
55
  mode_pred = gr.Radio(
 
58
  label="Assessment Type"
59
  )
60
  doc_id_pred = gr.Textbox(
61
+ label="Patient Document ID <umWSG13rLSfHqqJlq1WluPzjLB93>",
62
  placeholder="e.g., umWSG13rLSfHqqJlq1WluPzjLB93"
63
  )
64
  output_pred = gr.JSON()
 
69
  outputs=output_pred
70
  )
71
 
72
+ # News Tab
73
  with gr.Tab("News"):
74
  gr.Markdown("### 📰 Dementia News for Different Audiences")
75
  mode_news = gr.Radio(
76
  choices=["patientnews", "doctornews"],
77
  value="patientnews",
78
+ label="News Audience",
79
+ api_name="assess_risk"
80
  )
81
  output_news = gr.JSON()
82
  btn_news = gr.Button("Fetch News")
83
  btn_news.click(
84
  fn=lambda mode: news_patient() if mode == "patientnews" else news_doctor(),
85
  inputs=[mode_news],
86
+ outputs=output_news,
87
+ api_name="get_news"
88
  )
89
 
90
  demo.launch()
crew.py CHANGED
@@ -358,7 +358,12 @@ def explain_dementia_risk_lifestyle(docID: str) -> str:
358
  except Exception as e:
359
  return f"SHAP explanation failed: {str(e)}"
360
 
361
-
 
 
 
 
 
362
 
363
  # Load 2 different llms for different purposes.
364
  llm_predict = LLM(model="huggingface/openai/gpt-oss-120b")
@@ -389,7 +394,7 @@ patient_news = Agent(
389
  backstory="You find and share clear, trustworthy news about dementia—like new treatments, daily care tips, and support resources—written for patients and caregivers.",
390
  verbose=True,
391
  llm=llm_news,
392
- tools=[calculate_dementia_risk_lifestyle, explain_dementia_risk_lifestyle]
393
  )
394
 
395
  doctor_news = Agent(
@@ -398,7 +403,7 @@ doctor_news = Agent(
398
  backstory="You find and summarize the latest clinical studies, guidelines, and expert insights on dementia—focused on diagnosis, treatment, and research for healthcare providers.",
399
  verbose=True,
400
  llm=llm_news,
401
- tools=[calculate_dementia_risk_lifestyle, explain_dementia_risk_lifestyle]
402
  )
403
 
404
  # Define tasks for agents
 
358
  except Exception as e:
359
  return f"SHAP explanation failed: {str(e)}"
360
 
361
+ @tool("gather_news_patient")
362
+ def gather_news_patient(return_json: bool = False):
363
+ return "patient news"
364
+ @tool("gather_news_doctor")
365
+ def gather_news_doctor(return_json: bool = False):
366
+ return "doctor news"
367
 
368
  # Load 2 different llms for different purposes.
369
  llm_predict = LLM(model="huggingface/openai/gpt-oss-120b")
 
394
  backstory="You find and share clear, trustworthy news about dementia—like new treatments, daily care tips, and support resources—written for patients and caregivers.",
395
  verbose=True,
396
  llm=llm_news,
397
+ tools=[gather_news_patient]
398
  )
399
 
400
  doctor_news = Agent(
 
403
  backstory="You find and summarize the latest clinical studies, guidelines, and expert insights on dementia—focused on diagnosis, treatment, and research for healthcare providers.",
404
  verbose=True,
405
  llm=llm_news,
406
+ tools=[gather_news_doctor]
407
  )
408
 
409
  # Define tasks for agents