bigyunicorn's picture
return the image file itself
88cf9a2
raw
history blame contribute delete
472 Bytes
#playground
import gradio as gr
from fastai.vision.all import *
from duckduckgo_search import ddg_images
def greet(name):
return "Hello " + name + "!!"
def returnImages(keyword):
urls= L(ddg_images(keyword, max_results=5)).itemgot("image")
dest = Path()
fpath = download_url(urls[0], dest, show_progress = False)
im = Image.open(fpath).to_thumb(256,512)
return im
iface = gr.Interface(fn=greet, inputs="text", outputs="image")
iface.launch()