Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,9 +2,6 @@ import gradio as gr
|
|
2 |
import requests
|
3 |
from AuthVerification import auth_verification
|
4 |
|
5 |
-
inputs = [gr.Image(type='pil', label='TAKE A PICTURE OF THE TRAY')]
|
6 |
-
outputs = [gr.Textbox(label='Comments')]
|
7 |
-
|
8 |
title = "Minimalistic Scanner, by Proppos"
|
9 |
|
10 |
def instant_predict(pil_image):
|
@@ -14,20 +11,77 @@ def instant_predict(pil_image):
|
|
14 |
print('Sending image to Proppos ...')
|
15 |
return 'nice'
|
16 |
|
17 |
-
def display_outputs(input_image
|
18 |
try:
|
19 |
instant_predict(input_image)
|
20 |
-
return "Image correctly sent to
|
21 |
except Exception as e:
|
22 |
-
return f"Error:{e}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
-
demo_app = gr.Interface(
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
)
|
31 |
|
32 |
|
33 |
-
demo_app.launch(auth=auth_verification)
|
|
|
2 |
import requests
|
3 |
from AuthVerification import auth_verification
|
4 |
|
|
|
|
|
|
|
5 |
title = "Minimalistic Scanner, by Proppos"
|
6 |
|
7 |
def instant_predict(pil_image):
|
|
|
11 |
print('Sending image to Proppos ...')
|
12 |
return 'nice'
|
13 |
|
14 |
+
def display_outputs(input_image):
|
15 |
try:
|
16 |
instant_predict(input_image)
|
17 |
+
return "Image correctly sent to scan with Proppos"
|
18 |
except Exception as e:
|
19 |
+
return f"Error: {e}"
|
20 |
+
|
21 |
+
with gr.Blocks(title=title, theme='huggingface') as demo_app:
|
22 |
+
with gr.Column():
|
23 |
+
input_image = gr.Image(type='pil', label='TAKE A PICTURE OF THE TRAY')
|
24 |
+
output_comments = gr.Textbox(label='Comments')
|
25 |
+
input_image.change(display_outputs, inputs=[input_image], outputs=[output_comments])
|
26 |
+
|
27 |
+
demo_app.launch(auth=auth_verification)
|
28 |
+
|
29 |
+
|
30 |
+
|
31 |
+
|
32 |
+
|
33 |
+
|
34 |
+
|
35 |
+
|
36 |
+
|
37 |
+
|
38 |
+
|
39 |
+
|
40 |
+
|
41 |
+
|
42 |
+
|
43 |
+
|
44 |
+
|
45 |
+
|
46 |
+
|
47 |
+
|
48 |
+
|
49 |
+
|
50 |
+
|
51 |
+
|
52 |
+
|
53 |
+
|
54 |
+
|
55 |
+
# import gradio as gr
|
56 |
+
# import requests
|
57 |
+
# from AuthVerification import auth_verification
|
58 |
+
|
59 |
+
# inputs = [gr.Image(type='pil', label='TAKE A PICTURE OF THE TRAY', sources=['webcam', 'clipboard'])]
|
60 |
+
# outputs = [gr.Textbox(label='Comments')]
|
61 |
+
|
62 |
+
# title = "Minimalistic Scanner, by Proppos"
|
63 |
+
|
64 |
+
# def instant_predict(pil_image):
|
65 |
+
# """
|
66 |
+
# Request
|
67 |
+
# """
|
68 |
+
# print('Sending image to Proppos ...')
|
69 |
+
# return 'nice'
|
70 |
+
|
71 |
+
# def display_outputs(input_image: gr.Image):
|
72 |
+
# try:
|
73 |
+
# instant_predict(input_image)
|
74 |
+
# return "Image correctly sent to scann with Proppos"
|
75 |
+
# except Exception as e:
|
76 |
+
# return f"Error:{e}"
|
77 |
|
78 |
+
# demo_app = gr.Interface(
|
79 |
+
# fn=display_outputs,
|
80 |
+
# inputs=inputs,
|
81 |
+
# outputs=outputs,
|
82 |
+
# title=title,
|
83 |
+
# theme='huggingface'
|
84 |
+
# )
|
85 |
|
86 |
|
87 |
+
# demo_app.launch(auth=auth_verification)
|