Update app.py
Browse files
app.py
CHANGED
|
@@ -18,6 +18,17 @@ model.to(device)
|
|
| 18 |
|
| 19 |
state = "start_or_clear"
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
def process_document(image):
|
| 22 |
img2.update(visible=True)
|
| 23 |
gr.update()
|
|
@@ -107,15 +118,6 @@ with gr.Blocks(css=css) as demo:
|
|
| 107 |
btn.click(fn=process_document, inputs=inp, outputs=[jsonout,imgout])
|
| 108 |
|
| 109 |
demo.launch()
|
| 110 |
-
|
| 111 |
-
if state == "start_or_clear":
|
| 112 |
-
state = 'processing' #current state becomes
|
| 113 |
-
return (gr.update(value="snowangel.gif",visible=True),gr.update(value="snowangel.gif",visible=True))
|
| 114 |
-
elif state == "processing":
|
| 115 |
-
state = 'finished_processing' #current state becomes
|
| 116 |
-
return (gr.update(value="",visible=False),gr.update(value="",visible=False))
|
| 117 |
-
elif state == "finished_processing":
|
| 118 |
-
state = 'processing' #current state becomes
|
| 119 |
-
return (gr.update(value="snowangel.gif",visible=True),gr.update(value="snowangel.gif",visible=True))
|
| 120 |
|
| 121 |
|
|
|
|
| 18 |
|
| 19 |
state = "start_or_clear"
|
| 20 |
|
| 21 |
+
def update_status(inp):
|
| 22 |
+
if state == "start_or_clear":
|
| 23 |
+
state = 'processing' #current state becomes
|
| 24 |
+
return (gr.update(value="snowangel.gif",visible=True),gr.update(value="snowangel.gif",visible=True))
|
| 25 |
+
elif state == "processing":
|
| 26 |
+
state = 'finished_processing' #current state becomes
|
| 27 |
+
return (gr.update(value="",visible=False),gr.update(value="",visible=False))
|
| 28 |
+
elif state == "finished_processing":
|
| 29 |
+
state = 'processing' #current state becomes
|
| 30 |
+
return (gr.update(value="snowangel.gif",visible=True),gr.update(value="snowangel.gif",visible=True))
|
| 31 |
+
|
| 32 |
def process_document(image):
|
| 33 |
img2.update(visible=True)
|
| 34 |
gr.update()
|
|
|
|
| 118 |
btn.click(fn=process_document, inputs=inp, outputs=[jsonout,imgout])
|
| 119 |
|
| 120 |
demo.launch()
|
| 121 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
|
| 123 |
|