Jenaydd commited on
Commit
0b5aa58
·
verified ·
1 Parent(s): de2011a

Create App.py

Browse files
Files changed (1) hide show
  1. App.py +24 -0
App.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from rembg import remove
3
+ from PIL import Image
4
+ import io
5
+
6
+ def convert_to_pod_design(image):
7
+ # Remove background
8
+ result = remove(image)
9
+
10
+ # Ensure 330 DPI and transparency
11
+ output = io.BytesIO()
12
+ result.save(output, format="PNG", dpi=(330, 330))
13
+ output.seek(0)
14
+ return output
15
+
16
+ interface = gr.Interface(
17
+ fn=convert_to_pod_design,
18
+ inputs=gr.Image(type="pil", label="Upload your design"),
19
+ outputs=gr.Image(type="pil", label="Optimized POD Design (330 DPI PNG)"),
20
+ title="POD Optimizer",
21
+ description="Upload any image to convert it into a 330-DPI, print-on-demand ready PNG for hoodies, tees, and more."
22
+ )
23
+
24
+ interface.launch()