Spaces:
Running
on
Zero
Running
on
Zero
Reset
Browse files
Rodin.py
CHANGED
@@ -74,7 +74,6 @@ def crop_image(image, type):
|
|
74 |
new_image.paste(cropped_image, (i * 360, 0))
|
75 |
return new_image
|
76 |
|
77 |
-
|
78 |
# Perform Rodin mesh operation
|
79 |
def rodin_mesh(prompt, group_uuid, settings, images, name, token):
|
80 |
images = [convert_base64_to_binary(img) for img in images]
|
@@ -95,7 +94,6 @@ def rodin_mesh(prompt, group_uuid, settings, images, name, token):
|
|
95 |
response = requests.post(f"{BASE_URL}/task/rodin_mesh", data=m, headers=headers)
|
96 |
return response
|
97 |
|
98 |
-
|
99 |
# Convert base64 to binary since the result from `rodin_preprocess_image` is encoded with base64
|
100 |
def convert_base64_to_binary(base64_string):
|
101 |
if ',' in base64_string:
|
|
|
74 |
new_image.paste(cropped_image, (i * 360, 0))
|
75 |
return new_image
|
76 |
|
|
|
77 |
# Perform Rodin mesh operation
|
78 |
def rodin_mesh(prompt, group_uuid, settings, images, name, token):
|
79 |
images = [convert_base64_to_binary(img) for img in images]
|
|
|
94 |
response = requests.post(f"{BASE_URL}/task/rodin_mesh", data=m, headers=headers)
|
95 |
return response
|
96 |
|
|
|
97 |
# Convert base64 to binary since the result from `rodin_preprocess_image` is encoded with base64
|
98 |
def convert_base64_to_binary(base64_string):
|
99 |
if ',' in base64_string:
|
app.py
CHANGED
@@ -3,10 +3,11 @@ os.system('pip uninstall -y gradio_fake3d')
|
|
3 |
os.system('pip install gradio_fake3d-0.0.3-py3-none-any.whl')
|
4 |
|
5 |
import gradio as gr
|
|
|
6 |
import re
|
7 |
from gradio_fake3d import Fake3D
|
8 |
from PIL import Image
|
9 |
-
from Rodin import Generator, crop_image, log
|
10 |
from constant import *
|
11 |
|
12 |
generator = Generator(USER, PASSWORD, TOKEN)
|
@@ -54,39 +55,11 @@ html_content = """
|
|
54 |
</div>
|
55 |
"""
|
56 |
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
}}
|
63 |
-
#elem_block_image img {{
|
64 |
-
max-height:{max_height}px;
|
65 |
-
object-fit: contain;
|
66 |
-
}}
|
67 |
-
#elem_block_image_crop img {{
|
68 |
-
max-height:{max_height}px;
|
69 |
-
background: repeating-linear-gradient(
|
70 |
-
-45deg,
|
71 |
-
transparent 0px,
|
72 |
-
transparent 20px,
|
73 |
-
#f0f0f0 20px,
|
74 |
-
#f0f0f0 40px
|
75 |
-
)
|
76 |
-
}}
|
77 |
-
label {{
|
78 |
-
user-select: none
|
79 |
-
}}
|
80 |
-
#elem_block_download_mesh {{
|
81 |
-
flex-grow: 1
|
82 |
-
}}
|
83 |
-
#elem_block_download_mesh div {{
|
84 |
-
min-height: auto
|
85 |
-
}}
|
86 |
-
#elem_button_draw {{
|
87 |
-
flex-grow: 1
|
88 |
-
}}
|
89 |
-
"""
|
90 |
|
91 |
example = [
|
92 |
["assets/00.png"],
|
@@ -133,7 +106,7 @@ def handle_prompt_change(prompt):
|
|
133 |
|
134 |
def clear_task(task_input=None):
|
135 |
"""_summary_
|
136 |
-
[cache_task_uuid, block_prompt, block_prompt_hint, fake3d
|
137 |
"""
|
138 |
log("INFO", "Clearing task...")
|
139 |
return "", "", "", [], "assets/white_image.png"
|
@@ -159,12 +132,6 @@ def crop_image_normal(image):
|
|
159 |
|
160 |
with gr.Blocks() as demo:
|
161 |
gr.HTML(html_content)
|
162 |
-
|
163 |
-
cache_task_uuid = gr.Text(value="", visible=False)
|
164 |
-
cache_raw_image = gr.Image(visible=False, type="pil")
|
165 |
-
cacha_empty = gr.Text(visible=False)
|
166 |
-
cache_image_base64 = gr.Text(visible=False)
|
167 |
-
|
168 |
with gr.Row():
|
169 |
with gr.Column():
|
170 |
block_image = gr.Image(height=256, image_mode="RGB", sources="upload", elem_classes="elem_imageupload", type="filepath")
|
|
|
3 |
os.system('pip install gradio_fake3d-0.0.3-py3-none-any.whl')
|
4 |
|
5 |
import gradio as gr
|
6 |
+
import spaces
|
7 |
import re
|
8 |
from gradio_fake3d import Fake3D
|
9 |
from PIL import Image
|
10 |
+
from Rodin import Generator, crop_image, log
|
11 |
from constant import *
|
12 |
|
13 |
generator = Generator(USER, PASSWORD, TOKEN)
|
|
|
55 |
</div>
|
56 |
"""
|
57 |
|
58 |
+
options = [
|
59 |
+
"Rodin Gen-1(0525)",
|
60 |
+
"OpenClay(600M) - Coming soon",
|
61 |
+
"OpenClay(200M) - Coming soon"
|
62 |
+
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
|
64 |
example = [
|
65 |
["assets/00.png"],
|
|
|
106 |
|
107 |
def clear_task(task_input=None):
|
108 |
"""_summary_
|
109 |
+
[cache_task_uuid, block_prompt, block_prompt_hint, fake3d]
|
110 |
"""
|
111 |
log("INFO", "Clearing task...")
|
112 |
return "", "", "", [], "assets/white_image.png"
|
|
|
132 |
|
133 |
with gr.Blocks() as demo:
|
134 |
gr.HTML(html_content)
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
with gr.Row():
|
136 |
with gr.Column():
|
137 |
block_image = gr.Image(height=256, image_mode="RGB", sources="upload", elem_classes="elem_imageupload", type="filepath")
|
empty.obj
DELETED
File without changes
|