final
Browse files- gradio_app.py +15 -16
gradio_app.py
CHANGED
@@ -175,7 +175,7 @@ def generate_and_process_3d(image: Image.Image) -> str:
|
|
175 |
filename = f'model_{unique_id}.glb'
|
176 |
output_path = os.path.join(OUTPUT_DIR, filename)
|
177 |
trimesh_mesh.export(output_path, file_type="glb", include_normals=True)
|
178 |
-
public_url = f"https://rgndgn-i3d.hf.space/file={Path(output_path).resolve()}"
|
179 |
|
180 |
return public_url
|
181 |
|
@@ -187,23 +187,22 @@ def generate_and_process_3d(image: Image.Image) -> str:
|
|
187 |
|
188 |
# Create Gradio interface
|
189 |
with gr.Blocks() as demo:
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
)
|
200 |
|
201 |
# Make textbox visible but hide it with CSS
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
|
208 |
input_img.upload(
|
209 |
fn=generate_and_process_3d,
|
|
|
175 |
filename = f'model_{unique_id}.glb'
|
176 |
output_path = os.path.join(OUTPUT_DIR, filename)
|
177 |
trimesh_mesh.export(output_path, file_type="glb", include_normals=True)
|
178 |
+
public_url = f"https://rgndgn-i3d.hf.space/gradio_api/file={Path(output_path).resolve()}"
|
179 |
|
180 |
return public_url
|
181 |
|
|
|
187 |
|
188 |
# Create Gradio interface
|
189 |
with gr.Blocks() as demo:
|
190 |
+
input_img = gr.Image(
|
191 |
+
type="pil",
|
192 |
+
label=None, # Remove the label
|
193 |
+
show_label=False, # Further remove label
|
194 |
+
sources="upload",
|
195 |
+
image_mode="RGBA",
|
196 |
+
width=40,
|
197 |
+
elem_id="hidden-upload" # Add an ID for CSS targeting
|
198 |
+
)
|
|
|
199 |
|
200 |
# Make textbox visible but hide it with CSS
|
201 |
+
model_url = gr.Textbox(
|
202 |
+
label="Model URL",
|
203 |
+
elem_id="model-url-output", # Add this for CSS targeting
|
204 |
+
show_copy_button=True,
|
205 |
+
)
|
206 |
|
207 |
input_img.upload(
|
208 |
fn=generate_and_process_3d,
|