import gradio as gr import transformers from transformers import pipeline p = pipeline("text-generation", "EleutherAI/gpt-neo-1.3B") im2caption = gr.Interface.load("spaces/akhaliq/CLIP_prefix_captioning") def im2story(img): caption = im2caption(img, "COCO") if caption[-1] == ".": caption = caption[:-1] story = p(caption)[0]["generated_text"] return story gr.Interface(im2story, gr.Image(type="filepath"), "text", title="Image 2 Story").launch()