Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -229,10 +229,16 @@ async def process_image(
|
|
| 229 |
timestamp = datetime.datetime.now().strftime('%Y%m%d%H%M%S%f')
|
| 230 |
object_name = f'object_{timestamp}_1.obj'
|
| 231 |
object_name_2 = f'object_{timestamp}_2.glb'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 232 |
|
| 233 |
if upload_file_to_s3(mesh_name_obj, 'framebucket3d',object_name) and upload_file_to_s3(mesh_name_glb, 'framebucket3d',object_name_2):
|
| 234 |
|
| 235 |
return {
|
|
|
|
| 236 |
"obj_path": f"https://framebucket3d.s3.amazonaws.com/{object_name}",
|
| 237 |
"glb_path": f"https://framebucket3d.s3.amazonaws.com/{object_name_2}"
|
| 238 |
|
|
|
|
| 229 |
timestamp = datetime.datetime.now().strftime('%Y%m%d%H%M%S%f')
|
| 230 |
object_name = f'object_{timestamp}_1.obj'
|
| 231 |
object_name_2 = f'object_{timestamp}_2.glb'
|
| 232 |
+
object_name_3 = f"object_{timestamp}.png"
|
| 233 |
+
preprocessed_image_tempfile = tempfile.NamedTemporaryFile(suffix=".png", delete=False)
|
| 234 |
+
preprocessed.save(preprocessed_image_tempfile.name)
|
| 235 |
+
upload_file_to_s3(preprocessed_image_tempfile.name, 'framebucket3d', object_name_3)
|
| 236 |
+
|
| 237 |
|
| 238 |
if upload_file_to_s3(mesh_name_obj, 'framebucket3d',object_name) and upload_file_to_s3(mesh_name_glb, 'framebucket3d',object_name_2):
|
| 239 |
|
| 240 |
return {
|
| 241 |
+
"img_path": f"https://framebucket3d.s3.amazonaws.com/{object_name_3}",
|
| 242 |
"obj_path": f"https://framebucket3d.s3.amazonaws.com/{object_name}",
|
| 243 |
"glb_path": f"https://framebucket3d.s3.amazonaws.com/{object_name_2}"
|
| 244 |
|