Spaces:
Sleeping
Sleeping
import os | |
import subprocess | |
import gradio as gr | |
def load_mesh(mesh_file_name): | |
try: | |
subprocess.run(["python", "text2room/generate_scene.py"]) | |
except Exception as e: | |
print(e) | |
search_files(".ply") | |
return mesh_file_name | |
def search_files(extension): | |
# recursively search for files with the given extension | |
files = [] | |
# print content of the current directory | |
print(os.listdir()) | |
# print content of the text2room directory | |
print(os.listdir("text2room")) | |
return files | |
iface = gr.Interface(fn=load_mesh, | |
inputs=gr.Model3D(), | |
outputs=gr.Model3D( | |
clear_color=[0.0, 0.0, 0.0, 0.0], label="3D Model"), | |
examples=[ | |
[os.path.join(os.path.dirname(__file__), "files/Bunny.obj")], | |
[os.path.join(os.path.dirname(__file__), "files/Duck.glb")], | |
[os.path.join(os.path.dirname(__file__), "files/Fox.gltf")], | |
[os.path.join(os.path.dirname(__file__), "files/face.obj")], | |
], | |
) | |
if __name__ == "__main__": | |
subprocess.run(["pip", "install", "git+https://github.com/facebookresearch/pytorch3d.git@stable"]) | |
iface.launch() | |