File size: 811 Bytes
0899c0c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
import gradio as gr
from transformers import AutoProcessor, AutoModel
# Model name
model_name = "facebook/VFusion3D"
# Load processor and model with trusted code
processor = AutoProcessor.from_pretrained(model_name, trust_remote_code=True)
model = AutoModel.from_pretrained(model_name, trust_remote_code=True)
# Define prediction function
def predict(input_text):
# Convert input into a format the model understands
inputs = processor(inputs=input_text, return_tensors="pt")
outputs = model(**inputs)
return outputs.logits.tolist()
# Gradio interface
interface = gr.Interface(
fn=predict,
inputs="text",
outputs="text",
title="VFusion3D Deployment",
description="A demo for facebook/VFusion3D model."
)
# Launch the app
if __name__ == "__main__":
interface.launch()
|