from fastapi import FastAPI from transformers import pipeline app = FastAPI() # Initialize the pipeline with the correct model type pipe = pipeline("text-generation", model="Qwen/Qwen2.5-VL-7B-Instruct", model_type="qwen2_5_vl") @app.get("/") def home(): return {"message": "FastAPI is running!"} @app.get("/generate") def generate(text: str): output = pipe(text) return {"output": output[0]['generated_text']}