abidlabs's picture
abidlabs HF Staff
Update app.py
7e92753
raw
history blame
501 Bytes
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")
im2caption = gr.Interface.load("spaces/akhaliq/CLIP_prefix_captioning")
def im2story(img):
caption = im2caption(img, "COCO")
story = p("Let me tell you a story about " + caption)[0]["generated_text"]
return story
gr.Interface(im2story, gr.Image(type="filepath"), "text").launch()