Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import requests
|
3 |
+
|
4 |
+
inputs = [gr.Image(type='pil', label='TAKE A PICTURE OF THE TRAY')]
|
5 |
+
outputs = [gr.Textbox(label='Comments')]
|
6 |
+
|
7 |
+
title = "Minimalistic Scanner, by Proppos"
|
8 |
+
|
9 |
+
def instant_predict(pil_image):
|
10 |
+
"""
|
11 |
+
Request
|
12 |
+
"""
|
13 |
+
print('Sending image to Proppos ...')
|
14 |
+
return 'nice'
|
15 |
+
|
16 |
+
def display_outputs(input_image: gr.Image):
|
17 |
+
try:
|
18 |
+
instant_predict(input_image)
|
19 |
+
return "Image correctly sent to scann with Proppos"
|
20 |
+
except Exception as e:
|
21 |
+
return f"Error:{e}"
|
22 |
+
|
23 |
+
demo_app = gr.Interface(
|
24 |
+
fn=display_outputs,
|
25 |
+
inputs=inputs,
|
26 |
+
outputs=outputs,
|
27 |
+
title=title,
|
28 |
+
theme='huggingface'
|
29 |
+
)
|
30 |
+
|
31 |
+
|
32 |
+
demo_app.launch()
|