litav commited on
Commit
786b627
verified
1 Parent(s): f67e289

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -8,7 +8,7 @@ model = CustomModel()
8
 
9
  def predict(image: Image.Image):
10
  # 住讬诪讜诇爪讬讛 砖诇 讝诪谉 注讬讘讜讚
11
- time.sleep(3)
12
 
13
  # 讛驻注诇转 讛诪讜讚诇 讻讚讬 诇住讜讜讙 讗转 讛转诪讜谞讛
14
  label, confidence = model.predict(image)
@@ -34,13 +34,13 @@ with gr.Blocks() as demo:
34
  # 讜讬讚讗讜 讗谞讬诪爪讬讛 (诪讜住转专 讘讛转讞诇讛)
35
  animation = gr.Video("https://cdn-uploads.huggingface.co/production/uploads/66d6f1b3b50e35e1709bfdf7/x7Ud8PO9QPfmrTvBVcCKE.mp4", visible=False)
36
 
37
- # 转讜爪讗讜转
38
- output_label = gr.Textbox(label="Classification Result", interactive=False, visible=True)
39
- output_confidence = gr.Textbox(label="Confidence", interactive=False, visible=True)
40
 
41
  # 讗讬专讜注讬诐
42
  image_input.change(loading_animation, inputs=image_input, outputs=[animation, output_label, output_confidence])
43
- image_input.submit(show_results, inputs=image_input, outputs=[animation, output_label, output_confidence])
44
 
45
  # 讛砖拽转 讛诪诪砖拽
46
  demo.launch()
 
8
 
9
  def predict(image: Image.Image):
10
  # 住讬诪讜诇爪讬讛 砖诇 讝诪谉 注讬讘讜讚
11
+ time.sleep(5)
12
 
13
  # 讛驻注诇转 讛诪讜讚诇 讻讚讬 诇住讜讜讙 讗转 讛转诪讜谞讛
14
  label, confidence = model.predict(image)
 
34
  # 讜讬讚讗讜 讗谞讬诪爪讬讛 (诪讜住转专 讘讛转讞诇讛)
35
  animation = gr.Video("https://cdn-uploads.huggingface.co/production/uploads/66d6f1b3b50e35e1709bfdf7/x7Ud8PO9QPfmrTvBVcCKE.mp4", visible=False)
36
 
37
+ # 转讜爪讗讜转 (诪讜住转专讜转 讘讛转讞诇讛)
38
+ output_label = gr.Textbox(label="Classification Result", interactive=False, visible=False)
39
+ output_confidence = gr.Textbox(label="Confidence", interactive=False, visible=False)
40
 
41
  # 讗讬专讜注讬诐
42
  image_input.change(loading_animation, inputs=image_input, outputs=[animation, output_label, output_confidence])
43
+ image_input.change(show_results, inputs=image_input, outputs=[animation, output_label, output_confidence])
44
 
45
  # 讛砖拽转 讛诪诪砖拽
46
  demo.launch()