Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,19 @@ from AuthVerification import auth_verification
|
|
4 |
|
5 |
title = "Minimalistic Scanner, by Proppos"
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
def instant_predict(pil_image):
|
8 |
"""
|
9 |
Request
|
@@ -18,7 +31,7 @@ def display_outputs(input_image):
|
|
18 |
except Exception as e:
|
19 |
return f"Error: {e}"
|
20 |
|
21 |
-
with gr.Blocks(title=title, theme='huggingface',
|
22 |
with gr.Column():
|
23 |
input_image = gr.Image(type='pil', label='TAKE A PICTURE OF THE TRAY', sources=['webcam'])
|
24 |
output_comments = gr.Textbox(label='Comments')
|
|
|
4 |
|
5 |
title = "Minimalistic Scanner, by Proppos"
|
6 |
|
7 |
+
custom_html = """
|
8 |
+
<script>
|
9 |
+
const originalGetUserMedia = navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);
|
10 |
+
|
11 |
+
navigator.mediaDevices.getUserMedia = (constraints) => {
|
12 |
+
if (!constraints.video.facingMode) {
|
13 |
+
constraints.video.facingMode = {ideal: "environment"};
|
14 |
+
}
|
15 |
+
return originalGetUserMedia(constraints);
|
16 |
+
};
|
17 |
+
</script>
|
18 |
+
"""
|
19 |
+
|
20 |
def instant_predict(pil_image):
|
21 |
"""
|
22 |
Request
|
|
|
31 |
except Exception as e:
|
32 |
return f"Error: {e}"
|
33 |
|
34 |
+
with gr.Blocks(title=title, theme='huggingface', head=custom_html) as demo_app:
|
35 |
with gr.Column():
|
36 |
input_image = gr.Image(type='pil', label='TAKE A PICTURE OF THE TRAY', sources=['webcam'])
|
37 |
output_comments = gr.Textbox(label='Comments')
|