File size: 829 Bytes
88f6837
 
 
 
66de87a
88f6837
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66de87a
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
# BELOW 2 ROWS NOT CORRECTLY WORKING !!!!!
# import gradio as gr
# gr.load("models/Efficient-Large-Model/VILA1.5-3b").launch()

import gradio as gr
from transformers import AutoModel, AutoProcessor

# Load model and processor
model = AutoModel.from_pretrained("Efficient-Large-Model/VILA1.5-3b")
processor = AutoProcessor.from_pretrained("Efficient-Large-Model/VILA1.5-3b")

# Define function for model inference
def predict(input_text):
    # Process and perform inference on input_text
    # Note: Adapt this based on your model’s expected inputs/outputs
    inputs = processor(text=input_text, return_tensors="pt")
    outputs = model(**inputs)
    return outputs.logits  # or other processing based on model outputs

# Launch Gradio interface
gr.Interface(
    fn=predict,
    inputs="text",
    outputs="text"
).launch()