Spaces:
Sleeping
Sleeping
import gradio as gr | |
import requests | |
from AuthVerification import auth_verification | |
title = "Minimalistic Scanner, by Proppos" | |
def instant_predict(pil_image): | |
""" | |
Request | |
""" | |
print('Sending image to Proppos ...') | |
return 'nice' | |
def display_outputs(input_image): | |
try: | |
instant_predict(input_image) | |
return "Image correctly sent to scan with Proppos" | |
except Exception as e: | |
return f"Error: {e}" | |
with gr.Blocks(title=title, theme='huggingface', js='select_back_camera.js') as demo_app: | |
with gr.Column(): | |
input_image = gr.Image(type='pil', label='TAKE A PICTURE OF THE TRAY', sources=['webcam']) | |
output_comments = gr.Textbox(label='Comments') | |
input_image.change(display_outputs, inputs=[input_image], outputs=[output_comments]) | |
demo_app.launch(auth=auth_verification) | |
# import gradio as gr | |
# import requests | |
# from AuthVerification import auth_verification | |
# inputs = [gr.Image(type='pil', label='TAKE A PICTURE OF THE TRAY', sources=['webcam', 'clipboard'])] | |
# outputs = [gr.Textbox(label='Comments')] | |
# title = "Minimalistic Scanner, by Proppos" | |
# def instant_predict(pil_image): | |
# """ | |
# Request | |
# """ | |
# print('Sending image to Proppos ...') | |
# return 'nice' | |
# def display_outputs(input_image: gr.Image): | |
# try: | |
# instant_predict(input_image) | |
# return "Image correctly sent to scann with Proppos" | |
# except Exception as e: | |
# return f"Error:{e}" | |
# demo_app = gr.Interface( | |
# fn=display_outputs, | |
# inputs=inputs, | |
# outputs=outputs, | |
# title=title, | |
# theme='huggingface' | |
# ) | |
# demo_app.launch(auth=auth_verification) |