Update app.py
Browse files
app.py
CHANGED
|
@@ -5,9 +5,12 @@ from PIL import Image
|
|
| 5 |
import uuid
|
| 6 |
import random
|
| 7 |
import bg
|
|
|
|
| 8 |
proc1=diff
|
| 9 |
proc2=diff
|
| 10 |
-
|
|
|
|
|
|
|
| 11 |
#proc2=gr.Interface.load("spaces/Omnibus/fast-diff")
|
| 12 |
|
| 13 |
sky = "https://huggingface.co/spaces/Omnibus/game-test/resolve/main/assets/sky.png"
|
|
@@ -65,31 +68,17 @@ def star_fn(inp):
|
|
| 65 |
rand = random.randint(1,200)
|
| 66 |
for i in range(rand):
|
| 67 |
inp+=" "
|
| 68 |
-
#dif = gr.Interface.load("models/stabilityai/stable-diffusion-2-1-base", live=True),
|
| 69 |
-
#dif = models[0]
|
| 70 |
uid=uuid.uuid4()
|
| 71 |
-
#output=proc2(inp,5,1)
|
| 72 |
output=proc2.send_it(inp,5,1)
|
| 73 |
-
print(output)
|
| 74 |
-
#output=dif(inp)
|
| 75 |
-
#in_url=f'https://omnibus-fast-diff.hf.space/file={output[0]}'
|
| 76 |
-
|
| 77 |
outp=Image.open(output[0])
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
#
|
| 82 |
-
#
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
outp=bg.rem_bg(outp)
|
| 86 |
|
| 87 |
-
|
| 88 |
-
#print(f'outp_bg:: {outp_bg}')
|
| 89 |
-
outp.save(f"{uid}_star.png")
|
| 90 |
-
out = os.path.abspath(f"{uid}_star.png")
|
| 91 |
-
out_url = f'https://omnibus-game-test.hf.space/file={out}'
|
| 92 |
-
return out_url,out_url
|
| 93 |
|
| 94 |
with gr.Blocks() as app:
|
| 95 |
with gr.Row():
|
|
|
|
| 5 |
import uuid
|
| 6 |
import random
|
| 7 |
import bg
|
| 8 |
+
from rembg import remove as rm
|
| 9 |
proc1=diff
|
| 10 |
proc2=diff
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
#bg1=gr.Interface.load("spaces/Omnibus/fast-bg-remove-mod")
|
| 14 |
#proc2=gr.Interface.load("spaces/Omnibus/fast-diff")
|
| 15 |
|
| 16 |
sky = "https://huggingface.co/spaces/Omnibus/game-test/resolve/main/assets/sky.png"
|
|
|
|
| 68 |
rand = random.randint(1,200)
|
| 69 |
for i in range(rand):
|
| 70 |
inp+=" "
|
|
|
|
|
|
|
| 71 |
uid=uuid.uuid4()
|
|
|
|
| 72 |
output=proc2.send_it(inp,5,1)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
outp=Image.open(output[0])
|
| 74 |
+
outrs = outp.resize((24,24))
|
| 75 |
+
print("resized")
|
| 76 |
+
outbg=rm(outrs)
|
| 77 |
+
#outbg.save(f"{uid}_star.png")
|
| 78 |
+
#out = os.path.abspath(f"{uid}_star.png")
|
| 79 |
+
#out_url = f'https://omnibus-game-test.hf.space/file={out}'
|
|
|
|
|
|
|
| 80 |
|
| 81 |
+
return outbg,outbg
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
with gr.Blocks() as app:
|
| 84 |
with gr.Row():
|