MonkeyJuice commited on
Commit
6b4229d
1 Parent(s): 7faca52

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -10
app.py CHANGED
@@ -6,7 +6,6 @@ import gradio as gr
6
  import PIL.Image
7
  import zipfile
8
  from genTag import genTag
9
- from cropImage import cropImage
10
  from checkIgnore import is_ignore
11
  from createTagDom import create_tag_dom
12
 
@@ -18,8 +17,7 @@ def predict(image: PIL.Image.Image):
18
  result_html = '<div>' + result_html + '</div>'
19
  result_filter = {key: value for key, value in result_threshold.items() if not is_ignore(key, 1)}
20
  result_text = '<div id="m5dd_result">' + ', '.join(result_filter.keys()) + '</div>'
21
- crop_image = cropImage(image)
22
- return result_html, result_text, crop_image
23
 
24
  def predict_batch(zip_file, progress=gr.Progress()):
25
  result = ''
@@ -46,12 +44,6 @@ with gr.Blocks(css="style.css", js="script.js") as demo:
46
  image_mode="RGBA",
47
  sources=["upload", "clipboard"])
48
  run_button = gr.Button('Run')
49
- with gr.Accordion(label="Crop Image", open=False):
50
- crop_image = gr.Image(elem_classes='m5dd_image2',
51
- format='jpg',
52
- show_label=False,
53
- show_share_button=False,
54
- container=False)
55
  result_text = gr.HTML(value="")
56
  with gr.Column(scale=2):
57
  result_html = gr.HTML(value="")
@@ -71,7 +63,7 @@ with gr.Blocks(css="style.css", js="script.js") as demo:
71
  run_button.click(
72
  fn=predict,
73
  inputs=[image],
74
- outputs=[result_html, result_text, crop_image],
75
  api_name='predict',
76
  )
77
  run_button2.click(
 
6
  import PIL.Image
7
  import zipfile
8
  from genTag import genTag
 
9
  from checkIgnore import is_ignore
10
  from createTagDom import create_tag_dom
11
 
 
17
  result_html = '<div>' + result_html + '</div>'
18
  result_filter = {key: value for key, value in result_threshold.items() if not is_ignore(key, 1)}
19
  result_text = '<div id="m5dd_result">' + ', '.join(result_filter.keys()) + '</div>'
20
+ return result_html, result_text
 
21
 
22
  def predict_batch(zip_file, progress=gr.Progress()):
23
  result = ''
 
44
  image_mode="RGBA",
45
  sources=["upload", "clipboard"])
46
  run_button = gr.Button('Run')
 
 
 
 
 
 
47
  result_text = gr.HTML(value="")
48
  with gr.Column(scale=2):
49
  result_html = gr.HTML(value="")
 
63
  run_button.click(
64
  fn=predict,
65
  inputs=[image],
66
+ outputs=[result_html, result_text],
67
  api_name='predict',
68
  )
69
  run_button2.click(