import gradio as gr from transformers import AutoModelForCausalLM, AutoTokenizer model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen-VL", device_map="auto", trust_remote_code=True) tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen-VL", trust_remote_code=True) def analyze_image(image, prompt): response = model.chat(tokenizer, query=prompt, image=image) return response gr.Interface( fn=analyze_image, inputs=[gr.Image(type="filepath"), gr.Textbox(label="Prompt")], outputs="text" ).launch()