Spaces:
Configuration error
Configuration error
Commit ·
c9ff1c2
1
Parent(s): 35b6d9d
add 3d part
Browse files200 unmodified lines20120220320420520620777 unmodified lines2852862872882892902912925 unmodified lines2982993003013023033043053063073083093103113123133143153163173183193203217 unmodified lines329330331332333334335336337338339340341342343344200 unmodified lines@spaces.GPUdef make3d(output_queue: SimpleQueue, images: Image.Image):print(f'type(images)={type(images)}')global modelif IS_FLEXICUBES:77 unmodified linessave_obj(vertices, faces, vertex_colors, mesh_fpath)print(f"Mesh saved to {mesh_fpath}")return mesh_out@rr.thread_local_stream("InstantMesh")def log_to_rr(input_image, do_remove_background, sample_steps, sample_seed):5 unmodified linesyield stream.read()# output_queue = SimpleQueue()# mvs_thread = threading.Thread(target=generate_mvs, args=[output_queue, input_image, sample_steps, sample_seed])# mvs_thread.start()# while True:# msg = output_queue.get()# if msg[0] == "z123_image":# z123_image = msg[1]# break# elif msg[0] == "log":# entity_path = msg[1]# entity = msg[2]# rr.log(entity_path, entity)# yield stream.read()# mvs_thread.join()for msg in generate_mvs(input_image, sample_steps, sample_seed):if msg[0] == "z123_image":z123_image = msg[1]7 unmodified linesrr.log("z123image", rr.Image(z123_image))yield stream.read()# mesh_fpath, mesh_glb_fpath = make3d(output_queue, z123_image)# while not output_queue.empty():# msg = output_queue.get()# if msg[0] == "log":# entity_path = msg[1]# entity = msg[2]# rr.log(entity_path, entity)# yield stream.read()_HEADER_ = '''<h2><b>Official 🤗 Gradio Demo</b></h2><h2><a href='https://github.com/TencentARC/InstantMesh' target='_blank'><b>InstantMesh: Efficient 3D Mesh Generation from a Single Image with Sparse-view Large Reconstruction Models</b></a></h2>200 unmodified lines20120220320420520620720820921021121221321421521621721877 unmodified lines2962972982993003013023035 unmodified lines3093103113123133147 unmodified lines322323324325326327328329330200 unmodified lines@spaces.GPUdef make3d(images: Image.Image):output_queue = SimpleQueue()handle = threading.Thread(target=_make3d, args=[output_queue, images])handle.start()while True:msg = output_queue.get()yield msgif msg[0] == "mesh":breakhandle.join()def _make3d(output_queue: SimpleQueue, images: Image.Image):print(f'type(images)={type(images)}')global modelif IS_FLEXICUBES:77 unmodified linessave_obj(vertices, faces, vertex_colors, mesh_fpath)print(f"Mesh saved to {mesh_fpath}")output_queue.put(("mesh", mesh_out))@rr.thread_local_stream("InstantMesh")def log_to_rr(input_image, do_remove_background, sample_steps, sample_seed):5 unmodified linesyield stream.read()for msg in generate_mvs(input_image, sample_steps, sample_seed):if msg[0] == "z123_image":z123_image = msg[1]7 unmodified linesrr.log("z123image", rr.Image(z123_image))yield stream.read()for msg in make3d(z123_image):if msg[0] == "log":rr.log(msg[1], msg[2])_HEADER_ = '''<h2><b>Official 🤗 Gradio Demo</b></h2><h2><a href='https://github.com/TencentARC/InstantMesh' target='_blank'><b>InstantMesh: Efficient 3D Mesh Generation from a Single Image with Sparse-view Large Reconstruction Models</b></a></h2>
app.py+17-31