Spaces:
Paused
Paused
Adibvafa commited on
Commit ·
11020f4
1
Parent(s): 7434f7c
Add tool download explanation.
Browse files
main.py
CHANGED
|
@@ -24,19 +24,19 @@ def initialize_agent(prompt_file, model_dir="/model-weights", temp_dir="temp", d
|
|
| 24 |
|
| 25 |
tools_dict = {
|
| 26 |
"ChestXRayClassifierTool": ChestXRayClassifierTool(device=device),
|
| 27 |
-
"ChestXRayReportGeneratorTool": ChestXRayReportGeneratorTool(
|
| 28 |
-
cache_dir=model_dir, device=device
|
| 29 |
-
),
|
| 30 |
"ChestXRaySegmentationTool": ChestXRaySegmentationTool(device=device),
|
| 31 |
"LlavaMedTool": LlavaMedTool(cache_dir=model_dir, device=device, load_in_8bit=True),
|
| 32 |
"XRayVQATool": XRayVQATool(cache_dir=model_dir, device=device),
|
| 33 |
-
"
|
|
|
|
|
|
|
| 34 |
"XRayPhraseGroundingTool": XRayPhraseGroundingTool(
|
| 35 |
cache_dir=model_dir, temp_dir=temp_dir, load_in_8bit=True, device=device
|
| 36 |
),
|
| 37 |
"ChestXRayGeneratorTool": ChestXRayGeneratorTool(
|
| 38 |
model_path=f"{model_dir}/roentgen", temp_dir=temp_dir, device=device
|
| 39 |
),
|
|
|
|
| 40 |
"DicomProcessorTool": DicomProcessorTool(temp_dir=temp_dir),
|
| 41 |
}
|
| 42 |
|
|
@@ -57,7 +57,12 @@ def initialize_agent(prompt_file, model_dir="/model-weights", temp_dir="temp", d
|
|
| 57 |
|
| 58 |
if __name__ == "__main__":
|
| 59 |
print("Starting server...")
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
demo = create_demo(agent, tools_dict)
|
| 62 |
|
| 63 |
demo.launch(server_name="0.0.0.0", server_port=8585, share=True)
|
|
|
|
| 24 |
|
| 25 |
tools_dict = {
|
| 26 |
"ChestXRayClassifierTool": ChestXRayClassifierTool(device=device),
|
|
|
|
|
|
|
|
|
|
| 27 |
"ChestXRaySegmentationTool": ChestXRaySegmentationTool(device=device),
|
| 28 |
"LlavaMedTool": LlavaMedTool(cache_dir=model_dir, device=device, load_in_8bit=True),
|
| 29 |
"XRayVQATool": XRayVQATool(cache_dir=model_dir, device=device),
|
| 30 |
+
"ChestXRayReportGeneratorTool": ChestXRayReportGeneratorTool(
|
| 31 |
+
cache_dir=model_dir, device=device
|
| 32 |
+
),
|
| 33 |
"XRayPhraseGroundingTool": XRayPhraseGroundingTool(
|
| 34 |
cache_dir=model_dir, temp_dir=temp_dir, load_in_8bit=True, device=device
|
| 35 |
),
|
| 36 |
"ChestXRayGeneratorTool": ChestXRayGeneratorTool(
|
| 37 |
model_path=f"{model_dir}/roentgen", temp_dir=temp_dir, device=device
|
| 38 |
),
|
| 39 |
+
"ImageVisualizerTool": ImageVisualizerTool(),
|
| 40 |
"DicomProcessorTool": DicomProcessorTool(temp_dir=temp_dir),
|
| 41 |
}
|
| 42 |
|
|
|
|
| 57 |
|
| 58 |
if __name__ == "__main__":
|
| 59 |
print("Starting server...")
|
| 60 |
+
|
| 61 |
+
# Setup model_dir to where you want to download the weights
|
| 62 |
+
# Some tools needs you to download the weights beforehand from Hugging Face
|
| 63 |
+
agent, tools_dict = initialize_agent(
|
| 64 |
+
"medrax/docs/system_prompts.txt", model_dir="/model-weights"
|
| 65 |
+
)
|
| 66 |
demo = create_demo(agent, tools_dict)
|
| 67 |
|
| 68 |
demo.launch(server_name="0.0.0.0", server_port=8585, share=True)
|