3d / app.py
nithinm19's picture
Create app.py
c15294b verified
raw
history blame
874 Bytes
import gradio as gr
from transformers import AutoModel, AutoProcessor
from PIL import Image
import torch
# Load model and processor
model = AutoModel.from_pretrained("zxhezexin/openlrm-mix-large-1.1")
processor = AutoProcessor.from_pretrained("zxhezexin/openlrm-mix-large-1.1")
# Define function to generate 3D output from 2D image
def image_to_3d(image):
inputs = processor(images=image, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
# This is placeholder logic; you'd need to process the outputs appropriately
return "3D Output Generated" # Replace with actual visualization code
# Gradio interface
interface = gr.Interface(
fn=image_to_3d,
inputs=gr.Image(type="pil"),
outputs="text", # Replace with "3D" if you can visualize the output
title="OpenLRM Mix-Large 1.1 - Image to 3D"
)
interface.launch()