gradio/demo/image_mod_default_image/run.ipynb
aliabid94 9b42ba8f10
Update guides esp plots (#8907)
* changes

* changes

* revert changes

* changes

* add changeset

* notebooks script

* changes

* changes

---------

Co-authored-by: Ali Abid <aliabid94@gmail.com>
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Ali Abdalla <ali.si3luwa@gmail.com>
2024-07-29 22:08:51 -07:00

1.7 KiB

Gradio Demo: image_mod_default_image

In [ ]:
!pip install -q gradio 
In [ ]:
# Downloading files from the demo repo
import os
os.mkdir('images')
!wget -q -O images/cheetah1.jpg https://github.com/gradio-app/gradio/raw/main/demo/image_mod_default_image/images/cheetah1.jpg
!wget -q -O images/lion.jpg https://github.com/gradio-app/gradio/raw/main/demo/image_mod_default_image/images/lion.jpg
!wget -q -O images/logo.png https://github.com/gradio-app/gradio/raw/main/demo/image_mod_default_image/images/logo.png
In [ ]:
import gradio as gr
import os

def image_mod(image):
    return image.rotate(45)

cheetah = os.path.join(os.path.abspath(''), "images/cheetah1.jpg")

demo = gr.Interface(image_mod, gr.Image(type="pil", value=cheetah), "image",
    flagging_options=["blurry", "incorrect", "other"], examples=[
        os.path.join(os.path.abspath(''), "images/lion.jpg"),
        os.path.join(os.path.abspath(''), "images/logo.png")
        ])

if __name__ == "__main__":
    demo.launch(max_file_size="70kb")