Upload 2 files
Browse files- app.py +29 -0
- requirements.txt +3 -0
app.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import AutoProcessor, AutoModel
|
3 |
+
|
4 |
+
# Step 1: Load the model and processor
|
5 |
+
model_name = "facebook/VFusion3D"
|
6 |
+
processor = AutoProcessor.from_pretrained(model_name)
|
7 |
+
model = AutoModel.from_pretrained(model_name)
|
8 |
+
|
9 |
+
# Step 2: Define the function to process inputs and get predictions
|
10 |
+
def predict(input_text):
|
11 |
+
# Convert input into a format the model understands
|
12 |
+
inputs = processor(inputs=input_text, return_tensors="pt")
|
13 |
+
# Get model predictions
|
14 |
+
outputs = model(**inputs)
|
15 |
+
# Return results (adjust based on the model's output format)
|
16 |
+
return outputs.logits.tolist()
|
17 |
+
|
18 |
+
# Step 3: Build the Gradio interface
|
19 |
+
interface = gr.Interface(
|
20 |
+
fn=predict,
|
21 |
+
inputs="text", # Change this based on model requirements
|
22 |
+
outputs="text", # Adjust output format as needed
|
23 |
+
title="VFusion3D Deployment",
|
24 |
+
description="A demo application."
|
25 |
+
)
|
26 |
+
|
27 |
+
# Step 4: Launch the app
|
28 |
+
if __name__ == "__main__":
|
29 |
+
interface.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
transformers==4.33.2
|
2 |
+
torch==2.0.1
|
3 |
+
gradio==3.40.1
|