Spaces:
Runtime error
Runtime error
File size: 474 Bytes
e0f5cfa |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
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() |