|
!pip --quiet install imageio[ffmpeg] PyMCubes trimesh rembg[gpu,cli] kiui |
|
|
|
import torch |
|
from transformers import AutoModel, AutoProcessor |
|
|
|
|
|
model = AutoModel.from_pretrained("jadechoghari/vfusion3d", trust_remote_code=True) |
|
processor = AutoProcessor.from_pretrained("jadechoghari/vfusion3d") |
|
|
|
|
|
import requests |
|
from PIL import Image |
|
from io import BytesIO |
|
|
|
image_url = 'https://sm.ign.com/ign_nordic/cover/a/avatar-gen/avatar-generations_prsz.jpg' |
|
response = requests.get(image_url) |
|
image = Image.open(BytesIO(response.content)) |
|
|
|
|
|
image, source_camera = processor(image) |
|
|
|
|
|
|
|
output_planes = model(image, source_camera) |
|
print("Planes shape:", output_planes.shape) |
|
|
|
|
|
output_planes, mesh_path = model(image, source_camera, export_mesh=True) |
|
print("Planes shape:", output_planes.shape) |
|
print("Mesh saved at:", mesh_path) |
|
|
|
|
|
output_planes, video_path = model(image, source_camera, export_video=True) |
|
print("Planes shape:", output_planes.shape) |
|
print("Video saved at:", video_path) |
|
|