kaiiddo commited on
Commit
5fb17f3
Β·
verified Β·
1 Parent(s): 5ee6d4d

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +58 -0
app.py ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # βœ… Import libraries
2
+ import gradio as gr
3
+ from rembg import remove
4
+ from PIL import Image
5
+ import io
6
+
7
+ # βœ… Background remover function
8
+ def remove_background(image: Image.Image) -> Image.Image:
9
+ buffered = io.BytesIO()
10
+ image.save(buffered, format="PNG")
11
+ img_bytes = buffered.getvalue()
12
+ output_bytes = remove(img_bytes)
13
+ output_image = Image.open(io.BytesIO(output_bytes)).convert("RGBA")
14
+ return output_image
15
+
16
+ # βœ… Example Images (updated with working URLs)
17
+ examples = [
18
+ ["https://upload.wikimedia.org/wikipedia/commons/thumb/1/15/Cat_August_2010-4.jpg/480px-Cat_August_2010-4.jpg"],
19
+ ["https://upload.wikimedia.org/wikipedia/commons/thumb/4/4d/Cat_November_2010-1a.jpg/480px-Cat_November_2010-1a.jpg"]
20
+ ]
21
+
22
+ # βœ… Social Media & Credits Markdown
23
+ socials = """
24
+ ### 🀝 Special Thanks
25
+ - Built with πŸ’– using [rembg](https://github.com/danielgatis/rembg) β€” the amazing open-source AI background remover.
26
+
27
+ ### πŸ‘¨β€πŸ’» Developer
28
+ - @Kaiiddo
29
+
30
+ ### πŸ”— Follow Me
31
+ - πŸ“Ί [YouTube](https://youtube.com/@kaiiddo)
32
+ - 🐦 [Twitter / X](https://twitter.com/kaiiddo)
33
+ - πŸ‘‹πŸ» [Telegram](https://telegram.me/kaiiddo)
34
+ - πŸ‘‘ [GitHub](https://github.com/prokaiiddo)
35
+ - 🌐 [BlueSky](https://bsky.app/profile/kaiiddo.bsky.social)
36
+ - πŸ’Ό [LinkedIn](https://www.linkedin.com/in/kaiiddo)
37
+ """
38
+
39
+ # βœ… Gradio Interface
40
+ interface = gr.Interface(
41
+ fn=remove_background,
42
+ inputs=gr.Image(type="pil", label="πŸ–ΌοΈ Upload Image"),
43
+ outputs=gr.Image(type="pil", label="🎯 Output (Transparent Background)"),
44
+ title="πŸ–ΌοΈ AI ClearCut - Background Remover",
45
+ description="""
46
+ Welcome to AI ClearCut!
47
+ Remove image backgrounds instantly using AI. Upload any image and get a transparent version in seconds.
48
+
49
+ βœ… Fast
50
+ βœ… Free
51
+ βœ… No Login Needed
52
+ """,
53
+ examples=examples,
54
+ article=socials
55
+ )
56
+
57
+ # βœ… Launch it on Colab (shareable public link)
58
+ interface.launch(share=True)