Commit ·
2770ba4
0
Parent(s):
Duplicate from xp3857/bg-1
Browse files
.gitattributes
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: null
|
| 3 |
+
emoji: 📃
|
| 4 |
+
colorFrom: gray
|
| 5 |
+
colorTo: yellow
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: 3.20.0
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
duplicated_from: xp3857/bg-1
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import requests
|
| 3 |
+
import random
|
| 4 |
+
r = requests.get(f'https://huggingface.co/spaces/xp3857/bin/raw/main/css.css')
|
| 5 |
+
css = r.text
|
| 6 |
+
name2 = "xp3857/bg-rem"
|
| 7 |
+
models=[
|
| 8 |
+
gr.Interface.load(f"spaces/{name2}"),
|
| 9 |
+
gr.Interface.load(f"spaces/{name2}"),
|
| 10 |
+
gr.Interface.load(f"spaces/{name2}"),
|
| 11 |
+
gr.Interface.load(f"spaces/{name2}"),
|
| 12 |
+
gr.Interface.load(f"spaces/{name2}"),
|
| 13 |
+
gr.Interface.load(f"spaces/{name2}"),
|
| 14 |
+
gr.Interface.load(f"spaces/{name2}"),
|
| 15 |
+
gr.Interface.load(f"spaces/{name2}"),
|
| 16 |
+
gr.Interface.load(f"spaces/{name2}"),
|
| 17 |
+
gr.Interface.load(f"spaces/{name2}"),
|
| 18 |
+
gr.Interface.load(f"spaces/{name2}"),
|
| 19 |
+
gr.Interface.load(f"spaces/{name2}"),
|
| 20 |
+
gr.Interface.load(f"spaces/{name2}"),
|
| 21 |
+
gr.Interface.load(f"spaces/{name2}"),
|
| 22 |
+
gr.Interface.load(f"spaces/{name2}"),
|
| 23 |
+
gr.Interface.load(f"spaces/{name2}"),
|
| 24 |
+
gr.Interface.load(f"spaces/{name2}"),
|
| 25 |
+
gr.Interface.load(f"spaces/{name2}"),
|
| 26 |
+
gr.Interface.load(f"spaces/{name2}"),
|
| 27 |
+
gr.Interface.load(f"spaces/{name2}"),
|
| 28 |
+
]
|
| 29 |
+
def rem_bg(input):
|
| 30 |
+
if input !=None:
|
| 31 |
+
rn = random.randint(0, 19)
|
| 32 |
+
space=spaces[rn]
|
| 33 |
+
result=space(input)
|
| 34 |
+
out1 = gr.Pil.update(value=result,visible=True)
|
| 35 |
+
out2 = gr.Accordion.update(label="Original Image",open=False)
|
| 36 |
+
else:
|
| 37 |
+
out1 = None
|
| 38 |
+
out2 = None
|
| 39 |
+
pass
|
| 40 |
+
return out1, out2
|
| 41 |
+
with gr.Blocks(css=css) as myface:
|
| 42 |
+
with gr.Row():
|
| 43 |
+
gr.Column()
|
| 44 |
+
with gr.Column():
|
| 45 |
+
with gr.Accordion(label="Input Image",open=True) as og:
|
| 46 |
+
in_win=gr.Pil(label="Input", interactive=True, batch=True, max_batch_size=20)
|
| 47 |
+
out_win=gr.Pil(label="Output",visible=False)
|
| 48 |
+
gr.Column()
|
| 49 |
+
in_win.change(rem_bg,in_win,[out_win,og])
|
| 50 |
+
myface.queue(concurrency_count=120)
|
| 51 |
+
myface.launch()
|
css.css
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.app.svelte-p7tiy3.svelte-p7tiy3{
|
| 2 |
+
background:None;
|
| 3 |
+
}
|
| 4 |
+
.unpadded_box.large.svelte-1vhybi6{
|
| 5 |
+
background:#6fbcffa8;
|
| 6 |
+
min-height:100%;
|
| 7 |
+
}
|
| 8 |
+
span.svelte-1l2rj76{
|
| 9 |
+
color:white;!important;
|
| 10 |
+
}
|
| 11 |
+
div.svelte-1fwqiwq .block{
|
| 12 |
+
background:#4d8df1;
|
| 13 |
+
}
|
| 14 |
+
.lg.svelte-1h4gtph{
|
| 15 |
+
background:#4d8df1;
|
| 16 |
+
color:white;
|
| 17 |
+
height:100px;
|
| 18 |
+
}
|
| 19 |
+
#restart{
|
| 20 |
+
position: relative;
|
| 21 |
+
font-family: "Poppins",sans-serif;
|
| 22 |
+
text-align: center;
|
| 23 |
+
border-radius: 8px;
|
| 24 |
+
background: #0063f787;
|
| 25 |
+
border-style: solid;
|
| 26 |
+
border-width: 1px;
|
| 27 |
+
border-color: #ffffff;
|
| 28 |
+
width: 100%;
|
| 29 |
+
height: 50%;
|
| 30 |
+
max-height: 200px;
|
| 31 |
+
padding: 0px 10px;
|
| 32 |
+
transform: translate(-50%,0%);
|
| 33 |
+
left: 50%;
|
| 34 |
+
}
|
| 35 |
+
#head{
|
| 36 |
+
color:white;
|
| 37 |
+
margin-top:15px;
|
| 38 |
+
margin-bottom:5px;
|
| 39 |
+
}
|
| 40 |
+
#cont{
|
| 41 |
+
color: white;
|
| 42 |
+
margin-top: 5px;
|
| 43 |
+
margin-bottom: 15px;
|
| 44 |
+
font-size: 1.1rem;
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
.lds-ellipsis {
|
| 48 |
+
display: inline-block;
|
| 49 |
+
position: relative;
|
| 50 |
+
width: 80px;
|
| 51 |
+
height: 80px;
|
| 52 |
+
|
| 53 |
+
}
|
| 54 |
+
.lds-ellipsis div {
|
| 55 |
+
position: absolute;
|
| 56 |
+
z-index:199999;
|
| 57 |
+
|
| 58 |
+
top: 33px;
|
| 59 |
+
width: 13px;
|
| 60 |
+
height: 13px;
|
| 61 |
+
border-radius: 50%;
|
| 62 |
+
background: blue;
|
| 63 |
+
animation-timing-function: cubic-bezier(0, 1, 1, 0);
|
| 64 |
+
}
|
| 65 |
+
.lds-ellipsis div:nth-child(1) {
|
| 66 |
+
left: 8px;
|
| 67 |
+
animation: lds-ellipsis1 0.6s infinite;
|
| 68 |
+
}
|
| 69 |
+
.lds-ellipsis div:nth-child(2) {
|
| 70 |
+
left: 8px;
|
| 71 |
+
animation: lds-ellipsis2 0.6s infinite;
|
| 72 |
+
}
|
| 73 |
+
.lds-ellipsis div:nth-child(3) {
|
| 74 |
+
left: 32px;
|
| 75 |
+
animation: lds-ellipsis2 0.6s infinite;
|
| 76 |
+
}
|
| 77 |
+
.lds-ellipsis div:nth-child(4) {
|
| 78 |
+
left: 56px;
|
| 79 |
+
animation: lds-ellipsis3 0.6s infinite;
|
| 80 |
+
}
|
| 81 |
+
@keyframes lds-ellipsis1 {
|
| 82 |
+
0% {
|
| 83 |
+
transform: scale(0);
|
| 84 |
+
}
|
| 85 |
+
100% {
|
| 86 |
+
transform: scale(1);
|
| 87 |
+
}
|
| 88 |
+
}
|
| 89 |
+
@keyframes lds-ellipsis3 {
|
| 90 |
+
0% {
|
| 91 |
+
transform: scale(1);
|
| 92 |
+
}
|
| 93 |
+
100% {
|
| 94 |
+
transform: scale(0);
|
| 95 |
+
}frames lds-ellipsis2 {
|
| 96 |
+
0% {
|
| 97 |
+
transform: translate(0, 0);
|
| 98 |
+
}
|
| 99 |
+
100% {
|
| 100 |
+
transform: translate(24px, 0);
|
| 101 |
+
}
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
}
|
| 105 |
+
@keyframes lds-ellipsis2 {
|
| 106 |
+
0% {
|
| 107 |
+
transform: translate(0, 0);
|
| 108 |
+
}
|
| 109 |
+
100% {
|
| 110 |
+
transform: translate(24px, 0);
|
| 111 |
+
}
|
| 112 |
+
}
|