File size: 481 Bytes
41e7b9b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from inference import infer_single_image, model, processor
import gradio as gr

def generate_caption(image, prompt):
    return infer_single_image(model, processor, image, prompt or "Describe this image.")

gr.Interface(
    fn=generate_caption,
    inputs=[
        gr.Image(type="pil", label="Upload Image"),
        gr.Textbox(label="Prompt (optional)")
    ],
    outputs=gr.Textbox(label="Generated Caption"),
    title="Qwen2.5-VL-7B Fine-tuned Image Captioning",
).launch()