mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-15 02:11:15 +08:00
9b42ba8f10
* 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>
29 lines
783 B
Python
29 lines
783 B
Python
import gradio as gr
|
|
import os
|
|
|
|
def image_mod(image):
|
|
return image.rotate(45)
|
|
|
|
new_samples = [
|
|
[os.path.join(os.path.dirname(__file__), "images/logo.png")],
|
|
[os.path.join(os.path.dirname(__file__), "images/tower.jpg")],
|
|
]
|
|
|
|
with gr.Blocks() as demo:
|
|
interface = gr.Interface(
|
|
image_mod,
|
|
gr.Image(type="pil"),
|
|
"image",
|
|
flagging_options=["blurry", "incorrect", "other"],
|
|
examples=[
|
|
os.path.join(os.path.dirname(__file__), "images/cheetah1.jpg"),
|
|
os.path.join(os.path.dirname(__file__), "images/lion.jpg"),
|
|
],
|
|
)
|
|
|
|
btn = gr.Button("Update Examples")
|
|
btn.click(lambda : gr.Dataset(samples=new_samples), None, interface.examples_handler.dataset)
|
|
|
|
if __name__ == "__main__":
|
|
demo.launch()
|