amazinghaha commited on
Commit
6d0dd24
1 Parent(s): 9501d8e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -22
app.py CHANGED
@@ -19,7 +19,6 @@ ALL_message = load_from_pkl(r'./label0601.pkl')
19
  Model_Paht = r'./model_epoch62.pth.tar'
20
  checkpoint = torch.load(Model_Paht,map_location='cpu')
21
 
22
- a = 5
23
  classnet = resnet50(
24
  num_classes=1,
25
  sample_size=128,
@@ -70,27 +69,7 @@ def inference():
70
  n = float(np.round(1-p, decimals=2))
71
  return {'急性期': n, '亚急性期': p}
72
 
73
- #
74
- #
75
- # def image_classifier(inp):
76
- # #return {'cat': 0.3, 'dog': 0.7}
77
- # return inp
78
- #
79
- # def image_read(inp):
80
- # image = sitk.GetArrayFromImage(sitk.ReadImage(inp))
81
- # ss = np.sum(image)
82
- # return str(ss)
83
- #
84
- #
85
- # def upload_file(files):
86
- # file_paths = [file.name for file in files]
87
- # return file_paths
88
- #
89
- # with gr.Blocks() as demo:
90
- # file_output = gr.File()
91
- # upload_button = gr.UploadButton("Click to Upload a File", file_types=["image", "video"], file_count="multiple")
92
- # upload_button.upload(upload_file, upload_button, gr.Code(''))
93
- # demo.launch()
94
 
95
  import gradio as gr
96
  import numpy as np
@@ -229,6 +208,16 @@ class App:
229
  btn2.click(get_medical_message, inputs=None, outputs=[out4,out6])
230
  #demo = gr.Series(get_name, prepend_hello, append_nice)
231
 
 
 
 
 
 
 
 
 
 
 
232
  demo.launch()
233
  app = App()
234
  # with gr.Blocks() as demo:
 
19
  Model_Paht = r'./model_epoch62.pth.tar'
20
  checkpoint = torch.load(Model_Paht,map_location='cpu')
21
 
 
22
  classnet = resnet50(
23
  num_classes=1,
24
  sample_size=128,
 
69
  n = float(np.round(1-p, decimals=2))
70
  return {'急性期': n, '亚急性期': p}
71
 
72
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
  import gradio as gr
75
  import numpy as np
 
208
  btn2.click(get_medical_message, inputs=None, outputs=[out4,out6])
209
  #demo = gr.Series(get_name, prepend_hello, append_nice)
210
 
211
+
212
+ gr.Markdown("##Examples")
213
+ gr.Examples(
214
+ #examples=r'F:\WorkSpacing\XS_data\FenQi\chuli_data\ALL\358small_exp4_cut_128_256_128\1093978_A_L_MRI.nii.gz',
215
+ examples=[os.path.join(os.path.dirname(__file__), "1093978_A_L_MRI.nii.gz")],
216
+ inputs=inp,
217
+ outputs=[out1, out2, out3,slider1,slider2,slider3],
218
+ fn=get_Image_reslice,
219
+ cache_examples=True,
220
+ )
221
  demo.launch()
222
  app = App()
223
  # with gr.Blocks() as demo: