Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
|
|
2 |
import diff
|
3 |
import os
|
4 |
from PIL import Image
|
5 |
-
|
6 |
sky = "https://huggingface.co/spaces/Omnibus/game-test/resolve/main/assets/sky.png"
|
7 |
platform = 'https://huggingface.co/spaces/Omnibus/game-test/resolve/main/assets/platform.png'
|
8 |
star = 'https://huggingface.co/spaces/Omnibus/game-test/resolve/main/assets/star.png'
|
@@ -27,6 +27,7 @@ def update_game(sky=None,platform=None,star=None,bomb=None,dude=None):
|
|
27 |
return game_fn(sky=sky)
|
28 |
|
29 |
def dif_fn(inp):
|
|
|
30 |
output=diff.send_it(inp,5,1)
|
31 |
outp=Image.open(output[0])
|
32 |
width, height = outp.size
|
@@ -37,8 +38,8 @@ def dif_fn(inp):
|
|
37 |
outp = outp.resize((800,800*rat))
|
38 |
else:
|
39 |
outp = outp.resize((800,800))
|
40 |
-
outp.save("
|
41 |
-
out = os.path.abspath("
|
42 |
out_url = f'https://omnibus-game-test.hf.space/file={out}'
|
43 |
return output[0],out_url
|
44 |
|
|
|
2 |
import diff
|
3 |
import os
|
4 |
from PIL import Image
|
5 |
+
import uuid
|
6 |
sky = "https://huggingface.co/spaces/Omnibus/game-test/resolve/main/assets/sky.png"
|
7 |
platform = 'https://huggingface.co/spaces/Omnibus/game-test/resolve/main/assets/platform.png'
|
8 |
star = 'https://huggingface.co/spaces/Omnibus/game-test/resolve/main/assets/star.png'
|
|
|
27 |
return game_fn(sky=sky)
|
28 |
|
29 |
def dif_fn(inp):
|
30 |
+
uid=uuid.uuid4()
|
31 |
output=diff.send_it(inp,5,1)
|
32 |
outp=Image.open(output[0])
|
33 |
width, height = outp.size
|
|
|
38 |
outp = outp.resize((800,800*rat))
|
39 |
else:
|
40 |
outp = outp.resize((800,800))
|
41 |
+
outp.save(f"{uid}_sky.png")
|
42 |
+
out = os.path.abspath(f"{uid}_sky.png")
|
43 |
out_url = f'https://omnibus-game-test.hf.space/file={out}'
|
44 |
return output[0],out_url
|
45 |
|