2020-08-20 05:27:22 +08:00
|
|
|
import gradio as gr
|
2022-07-01 13:27:35 +08:00
|
|
|
import os
|
2020-08-20 05:27:22 +08:00
|
|
|
|
2022-01-21 21:44:12 +08:00
|
|
|
|
2020-08-20 05:27:22 +08:00
|
|
|
def image_mod(image):
|
2020-08-22 05:20:05 +08:00
|
|
|
return image.rotate(45)
|
2020-08-20 05:27:22 +08:00
|
|
|
|
2022-01-21 21:44:12 +08:00
|
|
|
|
2023-01-21 05:24:24 +08:00
|
|
|
demo = gr.Interface(
|
|
|
|
image_mod,
|
|
|
|
gr.Image(type="pil"),
|
|
|
|
"image",
|
|
|
|
flagging_options=["blurry", "incorrect", "other"],
|
|
|
|
examples=[
|
2022-07-01 13:27:35 +08:00
|
|
|
os.path.join(os.path.dirname(__file__), "images/cheetah1.jpg"),
|
|
|
|
os.path.join(os.path.dirname(__file__), "images/lion.jpg"),
|
2023-01-21 05:24:24 +08:00
|
|
|
os.path.join(os.path.dirname(__file__), "images/logo.png"),
|
|
|
|
os.path.join(os.path.dirname(__file__), "images/tower.jpg"),
|
|
|
|
],
|
|
|
|
)
|
2022-03-29 05:22:49 +08:00
|
|
|
|
2020-10-23 22:28:30 +08:00
|
|
|
if __name__ == "__main__":
|
2022-03-29 05:22:49 +08:00
|
|
|
demo.launch()
|