Update app.py
Browse files
app.py
CHANGED
@@ -71,14 +71,10 @@ caption.caption {
|
|
71 |
cursor: text;
|
72 |
}
|
73 |
|
74 |
-
div#
|
75 |
max-height: 63.39px;
|
76 |
}
|
77 |
|
78 |
-
div#component-9 {
|
79 |
-
background-color: tomato;
|
80 |
-
}
|
81 |
-
|
82 |
.svelte-snayfm {
|
83 |
height: auto;
|
84 |
}
|
@@ -87,6 +83,51 @@ div#component-9 {
|
|
87 |
width: 48px;
|
88 |
height: 48px;
|
89 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
"""
|
91 |
|
92 |
js = """
|
@@ -127,7 +168,7 @@ head = """
|
|
127 |
</script>
|
128 |
"""
|
129 |
|
130 |
-
output = gr.Gallery(label="
|
131 |
col2 = gr.Column(scale=2, visible=False)
|
132 |
|
133 |
def init_ui():
|
@@ -139,15 +180,24 @@ def search_ui():
|
|
139 |
def search_face_examples(image):
|
140 |
return search_face(image), gr.update(visible=False), gr.update(visible=True)
|
141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
MARKDOWN0 = """
|
143 |
# Free Face Search Online - β€οΈLike above if this space helps
|
144 |
#### [Learn more about our Reverse Face Search](https://faceonlive.com/face-search-online)
|
145 |
#### [Check out our Face Search API integration and Affiliate Program here.](https://portfolio.faceonlive.com/#face_search)
|
146 |
"""
|
147 |
-
MARKDOWN1 = """
|
148 |
-
### [Get Premium Token - Deep Search & Social Media Access](https://faceonlive.pocketsflow.com/checkout?productId=676c15b1971244a587ca07cb)
|
149 |
-
### [Protect Your Privacy β Start Your Takedown Now](https://faceonlive.pocketsflow.com/checkout?productId=676d7e7597f8b3b699f84820)
|
150 |
-
"""
|
151 |
MARKDOWN2 = """
|
152 |
### [Why Get the Premium Token?](https://faceonlive.pocketsflow.com/checkout?productId=676c15b1971244a587ca07cb)
|
153 |
β
**Deep Search**
|
@@ -156,8 +206,12 @@ MARKDOWN2 = """
|
|
156 |
β
**No Subscription Needed**
|
157 |
"""
|
158 |
MARKDOWN3 = """
|
|
|
159 |
<div align="right"><a href="https://faceonlive.com/reverse-image-search" target='_blank' style='font-size: 16px;'>Looking For Reverse Image Search</div>
|
160 |
"""
|
|
|
|
|
|
|
161 |
with gr.Blocks(css=custom_css, head=head, delete_cache=(3600, 3600)) as demo:
|
162 |
gr.Markdown(MARKDOWN0)
|
163 |
with gr.Row():
|
@@ -165,12 +219,14 @@ with gr.Blocks(css=custom_css, head=head, delete_cache=(3600, 3600)) as demo:
|
|
165 |
image = gr.Image(type='filepath', height=360)
|
166 |
with gr.Row():
|
167 |
with gr.Column():
|
168 |
-
token = gr.Textbox(placeholder="(Optional)
|
169 |
-
gr.Markdown(MARKDOWN1)
|
170 |
with gr.Column():
|
171 |
md_premium1 = gr.Markdown(MARKDOWN2)
|
172 |
with gr.Row():
|
173 |
-
|
|
|
|
|
|
|
174 |
gr.HTML(MARKDOWN3)
|
175 |
gr.Examples(['examples/1.jpg', 'examples/2.jpg'], inputs=image, cache_examples=True, fn=search_face_examples, outputs=[output, col1, col2])
|
176 |
|
@@ -178,23 +234,32 @@ with gr.Blocks(css=custom_css, head=head, delete_cache=(3600, 3600)) as demo:
|
|
178 |
gr.Markdown("> ### **β οΈ Reminder:** Export images before refreshing the page by clicking the 'Export Images' button.")
|
179 |
output.render()
|
180 |
with gr.Row():
|
181 |
-
|
182 |
-
|
|
|
|
|
|
|
|
|
183 |
with gr.Row():
|
184 |
with gr.Column():
|
185 |
-
gr.
|
186 |
with gr.Column():
|
187 |
-
|
188 |
-
new_search_button = gr.Button("π Try New Search")
|
189 |
gr.HTML(MARKDOWN3)
|
190 |
|
191 |
-
|
192 |
-
|
193 |
export_button.click(export_images, inputs=[output], outputs=export_file, api_name=False)
|
194 |
new_search_button.click(init_ui, inputs=[], outputs=[col1, col2], api_name=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
|
196 |
-
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/visitors?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2FFaceOnLive%2FFace-Search-Online&labelColor=%23ff8a65&countColor=%2337d67a&style=flat&labelStyle=upper" /></a>')
|
197 |
-
html = gr.HTML()
|
198 |
demo.load(None, inputs=None, outputs=html, js=js)
|
|
|
199 |
|
200 |
demo.queue(api_open=False, default_concurrency_limit=8).launch(show_api=False)
|
|
|
71 |
cursor: text;
|
72 |
}
|
73 |
|
74 |
+
div#export_file {
|
75 |
max-height: 63.39px;
|
76 |
}
|
77 |
|
|
|
|
|
|
|
|
|
78 |
.svelte-snayfm {
|
79 |
height: auto;
|
80 |
}
|
|
|
83 |
width: 48px;
|
84 |
height: 48px;
|
85 |
}
|
86 |
+
|
87 |
+
.button-gradient {
|
88 |
+
background: linear-gradient(45deg, #ff416c, #ff4b2b, #ff9b00, #ff416c);
|
89 |
+
background-size: 400% 400%;
|
90 |
+
border: none;
|
91 |
+
padding: 14px 28px;
|
92 |
+
font-size: 16px;
|
93 |
+
font-weight: bold;
|
94 |
+
color: white;
|
95 |
+
border-radius: 10px;
|
96 |
+
cursor: pointer;
|
97 |
+
transition: 0.3s ease-in-out;
|
98 |
+
animation: gradientAnimation 2s infinite linear;
|
99 |
+
box-shadow: 0 4px 10px rgba(255, 65, 108, 0.6);
|
100 |
+
}
|
101 |
+
|
102 |
+
@keyframes gradientAnimation {
|
103 |
+
0% { background-position: 0% 50%; }
|
104 |
+
25% { background-position: 50% 100%; }
|
105 |
+
50% { background-position: 100% 50%; }
|
106 |
+
75% { background-position: 50% 0%; }
|
107 |
+
100% { background-position: 0% 50%; }
|
108 |
+
}
|
109 |
+
|
110 |
+
.button-gradient:hover {
|
111 |
+
transform: scale(1.05);
|
112 |
+
box-shadow: 0 6px 15px rgba(255, 75, 43, 0.8);
|
113 |
+
}
|
114 |
+
|
115 |
+
@keyframes labelGradientFlow {
|
116 |
+
0% { background-position: 0% 50%; }
|
117 |
+
50% { background-position: 100% 50%; }
|
118 |
+
100% { background-position: 0% 50%; }
|
119 |
+
}
|
120 |
+
|
121 |
+
label.svelte-i3tvor.float {
|
122 |
+
background: linear-gradient(90deg, #555555, #333333, #555555); /* Dark gray gradient */
|
123 |
+
background-size: 200% 200%;
|
124 |
+
color: #f1f1f1;
|
125 |
+
font-weight: bold;
|
126 |
+
text-align: center;
|
127 |
+
animation: labelGradientFlow 4s infinite ease-in-out;
|
128 |
+
box-shadow: 0 0 6px rgba(50, 50, 50, 0.7); /* Subtle dark glow */
|
129 |
+
transition: all 0.3s ease-in-out;
|
130 |
+
}
|
131 |
"""
|
132 |
|
133 |
js = """
|
|
|
168 |
</script>
|
169 |
"""
|
170 |
|
171 |
+
output = gr.Gallery(label="Search may take a few minutes.)", columns=[3], object_fit="contain", height="480px", interactive=False)
|
172 |
col2 = gr.Column(scale=2, visible=False)
|
173 |
|
174 |
def init_ui():
|
|
|
180 |
def search_face_examples(image):
|
181 |
return search_face(image), gr.update(visible=False), gr.update(visible=True)
|
182 |
|
183 |
+
def set_url_token(request: gr.Request):
|
184 |
+
if request and request.query_params:
|
185 |
+
params = dict(request.query_params)
|
186 |
+
if "ptoken" in params:
|
187 |
+
return params["ptoken"]
|
188 |
+
return ""
|
189 |
+
|
190 |
+
def update_button(token):
|
191 |
+
if token:
|
192 |
+
return gr.update(visible=False), gr.update(value="π Unlock Deep Search Now!", elem_classes="button-gradient")
|
193 |
+
else:
|
194 |
+
return gr.update(visible=True), gr.update(value="π Free Face Search", elem_classes="")
|
195 |
+
|
196 |
MARKDOWN0 = """
|
197 |
# Free Face Search Online - β€οΈLike above if this space helps
|
198 |
#### [Learn more about our Reverse Face Search](https://faceonlive.com/face-search-online)
|
199 |
#### [Check out our Face Search API integration and Affiliate Program here.](https://portfolio.faceonlive.com/#face_search)
|
200 |
"""
|
|
|
|
|
|
|
|
|
201 |
MARKDOWN2 = """
|
202 |
### [Why Get the Premium Token?](https://faceonlive.pocketsflow.com/checkout?productId=676c15b1971244a587ca07cb)
|
203 |
β
**Deep Search**
|
|
|
206 |
β
**No Subscription Needed**
|
207 |
"""
|
208 |
MARKDOWN3 = """
|
209 |
+
<div align="right"><a href="https://faceonlive.pocketsflow.com/checkout?productId=676d7e7597f8b3b699f84820" target='_blank' style='font-size: 16px;'>Opt-Out From Search</div><br/>
|
210 |
<div align="right"><a href="https://faceonlive.com/reverse-image-search" target='_blank' style='font-size: 16px;'>Looking For Reverse Image Search</div>
|
211 |
"""
|
212 |
+
|
213 |
+
PREMIUM_CHECKOUT = "https://faceonlive.pocketsflow.com/checkout?productId=676c15b1971244a587ca07cb"
|
214 |
+
|
215 |
with gr.Blocks(css=custom_css, head=head, delete_cache=(3600, 3600)) as demo:
|
216 |
gr.Markdown(MARKDOWN0)
|
217 |
with gr.Row():
|
|
|
219 |
image = gr.Image(type='filepath', height=360)
|
220 |
with gr.Row():
|
221 |
with gr.Column():
|
222 |
+
token = gr.Textbox(placeholder="(Optional) Input Premium Token here.", label="Premium Token")
|
|
|
223 |
with gr.Column():
|
224 |
md_premium1 = gr.Markdown(MARKDOWN2)
|
225 |
with gr.Row():
|
226 |
+
with gr.Column():
|
227 |
+
premium_search_button = gr.Button("π Unlock Deep Search Now!", elem_classes="button-gradient", link=PREMIUM_CHECKOUT)
|
228 |
+
with gr.Column():
|
229 |
+
face_search_button = gr.Button("π Free Face Search")
|
230 |
gr.HTML(MARKDOWN3)
|
231 |
gr.Examples(['examples/1.jpg', 'examples/2.jpg'], inputs=image, cache_examples=True, fn=search_face_examples, outputs=[output, col1, col2])
|
232 |
|
|
|
234 |
gr.Markdown("> ### **β οΈ Reminder:** Export images before refreshing the page by clicking the 'Export Images' button.")
|
235 |
output.render()
|
236 |
with gr.Row():
|
237 |
+
with gr.Column():
|
238 |
+
md_premium2 = gr.Markdown(MARKDOWN2)
|
239 |
+
with gr.Column():
|
240 |
+
export_button = gr.Button("Export Images")
|
241 |
+
export_file = gr.File(label="Download", elem_id="export_file")
|
242 |
+
|
243 |
with gr.Row():
|
244 |
with gr.Column():
|
245 |
+
premium_link_button = gr.Button("π Unlock Deep Search Now!", elem_classes="button-gradient", link=PREMIUM_CHECKOUT)
|
246 |
with gr.Column():
|
247 |
+
new_search_button = gr.Button("π New Search")
|
|
|
248 |
gr.HTML(MARKDOWN3)
|
249 |
|
250 |
+
face_search_button.click(search_ui, inputs=[], outputs=[col1, col2], api_name=False)
|
251 |
+
face_search_button.click(search_face, inputs=[image, token], outputs=[output], api_name=False)
|
252 |
export_button.click(export_images, inputs=[output], outputs=export_file, api_name=False)
|
253 |
new_search_button.click(init_ui, inputs=[], outputs=[col1, col2], api_name=False)
|
254 |
+
token.change(update_button, inputs=[token], outputs=[premium_search_button, face_search_button])
|
255 |
+
|
256 |
+
with gr.Row():
|
257 |
+
with gr.Column(scale=1):
|
258 |
+
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/visitors?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2FFaceOnLive%2FFace-Search-Online&labelColor=%23ff8a65&countColor=%2337d67a&style=flat&labelStyle=upper" /></a>')
|
259 |
+
with gr.Column(scale=5):
|
260 |
+
html = gr.HTML()
|
261 |
|
|
|
|
|
262 |
demo.load(None, inputs=None, outputs=html, js=js)
|
263 |
+
demo.load(set_url_token, inputs=None, outputs=[token])
|
264 |
|
265 |
demo.queue(api_open=False, default_concurrency_limit=8).launch(show_api=False)
|