Spaces:
Runtime error
Runtime error
try now
Browse files
app.py
CHANGED
@@ -119,14 +119,12 @@ def generate_3D(input, model_name='base1B', guidance_scale=3.0, grid_size=128):
|
|
119 |
set_state('Converting to mesh...')
|
120 |
|
121 |
uniqid = uuid.uuid4()
|
122 |
-
file_path = f'/tmp/
|
123 |
-
|
124 |
-
print(file_path)
|
125 |
-
pc.save(file_path)
|
126 |
|
127 |
set_state('')
|
128 |
|
129 |
-
return file_path, create_gif(pc), gr.update(value=[
|
130 |
|
131 |
def prepare_img(img):
|
132 |
|
@@ -150,6 +148,11 @@ def ply_to_glb(ply_file, glb_file):
|
|
150 |
|
151 |
return glb_file
|
152 |
|
|
|
|
|
|
|
|
|
|
|
153 |
|
154 |
def create_gif(pc):
|
155 |
fig = plt.figure(facecolor='black', figsize=(4, 4))
|
|
|
119 |
set_state('Converting to mesh...')
|
120 |
|
121 |
uniqid = uuid.uuid4()
|
122 |
+
file_path = f'/tmp/{uniqid}.ply'
|
123 |
+
save_ply(pc, file_path)
|
|
|
|
|
124 |
|
125 |
set_state('')
|
126 |
|
127 |
+
return file_path, create_gif(pc), gr.update(value=[file_path], visible=True)
|
128 |
|
129 |
def prepare_img(img):
|
130 |
|
|
|
148 |
|
149 |
return glb_file
|
150 |
|
151 |
+
def save_ply(pc, file_name):
|
152 |
+
# Produce a mesh (with vertex colors)
|
153 |
+
with open(file_name, 'wb') as f:
|
154 |
+
pc.write_ply(f)
|
155 |
+
|
156 |
|
157 |
def create_gif(pc):
|
158 |
fig = plt.figure(facecolor='black', figsize=(4, 4))
|