from fastapi import FastAPI from diffusers import DiffusionPipeline import json import requests from PIL import Image from io import BytesIO app = FastAPI() pipeline = DiffusionPipeline.from_pretrained("ogkalu/Comic-Diffusion") pipeline = pipeline.to("cpu") @app.get("/") def read_root(): prompt = "anime boy" image = pipeline(prompt,width=256,height=256,num_inference_steps=10).images[0] print('Success Ok') return image