Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -17,23 +17,25 @@ def freemium_watermark(img, sb_logo):
|
|
17 |
sb_logo = Image.blend(transparent_img, sb_logo, alpha=0.3) # Blend the logo with the transparent image
|
18 |
# Calculate the position to paste the logo at the center of the image
|
19 |
paste_x_position = (width_px - new_logo_width) // 2
|
20 |
-
paste_y_position = int(height_px * 0.
|
21 |
img.paste(sb_logo, (paste_x_position, paste_y_position), sb_logo)
|
22 |
# Save the image
|
23 |
return img
|
24 |
|
|
|
25 |
sb_logo = Image.open("./SB_logo_horizontal.png")
|
26 |
-
|
27 |
with gr.Blocks(analytics_enabled=False, theme=gr.themes.Soft()) as demo:
|
28 |
with gr.Row():
|
29 |
with gr.Column():
|
30 |
input = gr.Image(type="pil", label="Upload Image", sources=["upload"])
|
|
|
|
|
31 |
with gr.Column():
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
@gr.on(inputs=[input], outputs=[
|
37 |
def sketch(input_path):
|
38 |
if input_path is None:
|
39 |
return None
|
@@ -47,4 +49,4 @@ with gr.Blocks(analytics_enabled=False, theme=gr.themes.Soft()) as demo:
|
|
47 |
line_img = Image.fromarray(line_drawing)
|
48 |
return freemium_watermark(line_img, sb_logo)
|
49 |
|
50 |
-
demo.queue(default_concurrency_limit=10).launch()
|
|
|
17 |
sb_logo = Image.blend(transparent_img, sb_logo, alpha=0.3) # Blend the logo with the transparent image
|
18 |
# Calculate the position to paste the logo at the center of the image
|
19 |
paste_x_position = (width_px - new_logo_width) // 2
|
20 |
+
paste_y_position = int(height_px * 0.4) - (new_logo_height // 2)
|
21 |
img.paste(sb_logo, (paste_x_position, paste_y_position), sb_logo)
|
22 |
# Save the image
|
23 |
return img
|
24 |
|
25 |
+
|
26 |
sb_logo = Image.open("./SB_logo_horizontal.png")
|
|
|
27 |
with gr.Blocks(analytics_enabled=False, theme=gr.themes.Soft()) as demo:
|
28 |
with gr.Row():
|
29 |
with gr.Column():
|
30 |
input = gr.Image(type="pil", label="Upload Image", sources=["upload"])
|
31 |
+
gr.ClearButton(components=input)
|
32 |
+
gr.Examples(examples=["hotel.jpg", "road_small.jpg", "preview_small.jpg", "trailer.jpg"], inputs=input)
|
33 |
with gr.Column():
|
34 |
+
output = gr.Image(type = "filepath", label="Sketch Drawing", show_share_button=False)
|
35 |
+
gr.Markdown("<p style='text-align: center; font-size: 20px;'>Want to remove the watermark?</p>\n")
|
36 |
+
gr.Markdown("<p style='text-align: center; font-size: 20px;'>Subscribe or <a href='https://skyebrowse.com/pricing'>purchase a model</a> starting at $3.<p>")
|
37 |
+
|
38 |
+
@gr.on(inputs=[input], outputs=[output], show_progress="minimal")
|
39 |
def sketch(input_path):
|
40 |
if input_path is None:
|
41 |
return None
|
|
|
49 |
line_img = Image.fromarray(line_drawing)
|
50 |
return freemium_watermark(line_img, sb_logo)
|
51 |
|
52 |
+
demo.queue(default_concurrency_limit=10).launch()
|