Spaces:
Paused
Paused
Adibvafa
commited on
Commit
·
f1b994a
1
Parent(s):
5b96cf3
hard code a fixed medgemma ip [WIP]
Browse files
main.py
CHANGED
|
@@ -92,7 +92,7 @@ def initialize_agent(
|
|
| 92 |
cache_dir=model_dir,
|
| 93 |
device=device,
|
| 94 |
load_in_8bit=True,
|
| 95 |
-
api_url=os.getenv("MEDGEMMA_API_URL", "http://
|
| 96 |
)
|
| 97 |
}
|
| 98 |
|
|
@@ -185,12 +185,12 @@ if __name__ == "__main__":
|
|
| 185 |
]
|
| 186 |
|
| 187 |
# Share a single cache directory and device across tools
|
| 188 |
-
|
| 189 |
-
|
| 190 |
|
| 191 |
# Setup the MedGemma environment if the MedGemmaVQATool is selected
|
| 192 |
if "MedGemmaVQATool" in selected_tools:
|
| 193 |
-
setup_medgemma_env(cache_dir=
|
| 194 |
|
| 195 |
# Configure the Retrieval Augmented Generation (RAG) system
|
| 196 |
# This allows the agent to access and use medical knowledge documents
|
|
@@ -214,10 +214,10 @@ if __name__ == "__main__":
|
|
| 214 |
agent, tools_dict = initialize_agent(
|
| 215 |
prompt_file="medrax/docs/system_prompts.txt",
|
| 216 |
tools_to_use=selected_tools,
|
| 217 |
-
model_dir=
|
| 218 |
temp_dir="temp2", # Change this to the path of the temporary directory
|
| 219 |
-
device=
|
| 220 |
-
model="gpt-
|
| 221 |
temperature=1.0,
|
| 222 |
model_kwargs=model_kwargs,
|
| 223 |
rag_config=rag_config,
|
|
|
|
| 92 |
cache_dir=model_dir,
|
| 93 |
device=device,
|
| 94 |
load_in_8bit=True,
|
| 95 |
+
api_url=os.getenv("MEDGEMMA_API_URL", "http://0.0.0.0:8002")
|
| 96 |
)
|
| 97 |
}
|
| 98 |
|
|
|
|
| 185 |
]
|
| 186 |
|
| 187 |
# Share a single cache directory and device across tools
|
| 188 |
+
model_dir = os.getenv("MODEL_WEIGHTS_DIR", "/model-weights")
|
| 189 |
+
device = os.getenv("MEDRAX_DEVICE", "cuda:0")
|
| 190 |
|
| 191 |
# Setup the MedGemma environment if the MedGemmaVQATool is selected
|
| 192 |
if "MedGemmaVQATool" in selected_tools:
|
| 193 |
+
setup_medgemma_env(cache_dir=model_dir, device=device)
|
| 194 |
|
| 195 |
# Configure the Retrieval Augmented Generation (RAG) system
|
| 196 |
# This allows the agent to access and use medical knowledge documents
|
|
|
|
| 214 |
agent, tools_dict = initialize_agent(
|
| 215 |
prompt_file="medrax/docs/system_prompts.txt",
|
| 216 |
tools_to_use=selected_tools,
|
| 217 |
+
model_dir=model_dir,
|
| 218 |
temp_dir="temp2", # Change this to the path of the temporary directory
|
| 219 |
+
device=device,
|
| 220 |
+
model="gpt-4.1", # Change this to the model you want to use, e.g. gpt-4.1-2025-04-14, gemini-2.5-pro, gpt-5
|
| 221 |
temperature=1.0,
|
| 222 |
model_kwargs=model_kwargs,
|
| 223 |
rag_config=rag_config,
|