9
def xray_model(diseases, img):
10
return {disease: random.random() for disease in diseases}
12
def ct_model(diseases, img):
13
return {disease: 0.1 for disease in diseases}
15
with gr.Blocks() as demo:
18
# Detect Disease From Scan
19
With this model you can lorem ipsum
24
disease = gr.CheckboxGroup(
25
choices=[["Covid", "Covid"], ["Malaria", "Malaria"], ["Lung Cancer", "Lung Cancer"]], label="Disease to Scan For"
29
with gr.TabItem("X-ray"):
31
xray_scan = gr.Image()
32
xray_results = gr.JSON()
33
xray_run = gr.Button("Run")
35
xray_model, inputs=[disease, xray_scan], outputs=xray_results
38
with gr.TabItem("CT Scan"):
41
ct_results = gr.JSON()
42
ct_run = gr.Button("Run")
44
ct_model, inputs=[disease, ct_scan], outputs=ct_results
46
textbox = gr.Textbox()
49
gr.context.Context.id = 100
51
with gr.Blocks() as demo2:
54
# Detect Disease From Scan
55
With this model you can lorem ipsum
60
disease = gr.CheckboxGroup(
61
choices=[["Covid", "Covid"], ["Malaria", "Malaria"], ["Lung Cancer", "Lung Cancer"]], label="Disease to Scan For"
65
with gr.TabItem("X-ray"):
67
xray_scan = gr.Image()
68
xray_results = gr.JSON()
69
xray_run = gr.Button("Run")
71
xray_model, inputs=[disease, xray_scan], outputs=xray_results
74
with gr.TabItem("CT Scan"):
77
ct_results = gr.JSON()
78
ct_run = gr.Button("Run")
80
ct_model, inputs=[disease, ct_scan], outputs=ct_results
82
textbox = gr.Textbox()
84
with gr.Blocks() as demo3:
87
demo3.load(fake_func, [], [t])
89
config = demo.get_config_file()
90
config2 = demo2.get_config_file()
91
config3 = demo3.get_config_file()
93
json_file_path = "../test/test_files/xray_config.json"
94
json_file_path2 = "../test/test_files/xray_config_diff_ids.json"
95
json_file_path3 = "../test/test_files/xray_config_wrong.json"
97
for c, j in zip([config, config2, config3], [json_file_path, json_file_path2, json_file_path3]):
98
assert os.path.exists(j), f"{j} does not exist"
99
with open(j, "w") as fp:
100
json.dump(c, fp, indent=2)