PerryCheng614 commited on
Commit
6a8a06c
·
1 Parent(s): 89a569e
Files changed (1) hide show
  1. app.py +31 -24
app.py CHANGED
@@ -1,30 +1,37 @@
 
1
  import gradio as gr
 
 
 
 
2
 
 
 
3
 
4
- def process_image_stream(question):
5
- return "This is a test response"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
- # Updated Gradio interface
8
- demo = gr.Blocks(theme="soft")
 
9
 
10
- with demo:
11
- with gr.Column(): # Changed from Row to Column for better mobile layout
12
- gr.Markdown("# Nexa Omni Vision")
13
-
14
- question = gr.Textbox(
15
- label="Question",
16
- placeholder="Ask a question about the image...",
17
- value="Describe this image",
18
- elem_classes="input-box" # Added class for CSS targeting
19
- )
20
-
21
- response = gr.Textbox(
22
- label="Response",
23
- interactive=False,
24
- elem_classes="output-box" # Added class for CSS targeting
25
- )
26
-
27
- question.submit(fn=process_image_stream, inputs=question, outputs=response)
28
 
29
- if __name__ == "__main__":
30
- demo.queue().launch(server_name="0.0.0.0", server_port=7860)
 
1
+ import os
2
  import gradio as gr
3
+ import requests
4
+ import base64
5
+ from io import BytesIO
6
+ from PIL import Image
7
 
8
+ def search_face(image):
9
+ return image, 1
10
 
11
+ with gr.Blocks() as demo:
12
+ gr.Markdown(
13
+ """
14
+ # Search Your Face Online For Free
15
+ ## For more detailed information, please check on our website.<br/>
16
+ ## [FaceOnLive: On-premises ID Verification, Biometric Authentication Solution Provider](https://faceonlive.com)
17
+ <br>
18
+
19
+ ## For premium support or partnership inquiries, contact us.
20
+ """
21
+ )
22
+ with gr.Row():
23
+ with gr.Column(scale=1):
24
+ image = gr.Image(type='filepath', height=480)
25
+ search_face_button = gr.Button("Search Face")
26
+ with gr.Column(scale=2):
27
+ output = gr.Gallery(label="Found Images", columns=[4], object_fit="contain", height="auto")
28
+ countwg = gr.Number(label="Count")
29
+
30
+ gr.Examples(['examples/1.jpg', 'examples/2.jpg'], inputs=image, cache_examples=True, cache_mode='lazy', fn=search_face, outputs=[output, countwg])
31
 
32
+ search_face_button.click(search_face, inputs=image, outputs=[output, countwg], api_name=False)
33
+
34
+ gr.HTML('<a href="https://visitorbadge.io/status?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2FFaceOnLive%2FFace-Search-Online"><img src="https://api.visitorbadge.io/api/combined?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2FFaceOnLive%2FFace-Search-Online&labelColor=%23ff8a65&countColor=%2337d67a&style=flat&labelStyle=upper" /></a>')
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
+ demo.queue(api_open=False).launch(server_name="0.0.0.0", server_port=7860, show_api=False)