Spaces:
Runtime error
Runtime error
req
Browse files
app.py
CHANGED
|
@@ -1,47 +1,18 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from PIL import Image
|
| 3 |
import os
|
| 4 |
|
| 5 |
|
| 6 |
-
def image_mod(
|
| 7 |
-
|
| 8 |
-
with Image.open(image_path) as im:
|
| 9 |
-
images.append(im.rotate(45))
|
| 10 |
-
images.append(im.rotate(90))
|
| 11 |
-
|
| 12 |
-
#files = os.listdir(os.curdir)
|
| 13 |
-
#print('local files: ',files)
|
| 14 |
-
#images[0].save("newlion.png")
|
| 15 |
-
#files = os.listdir(os.curdir)
|
| 16 |
-
#print('local files: ',files)
|
| 17 |
|
| 18 |
-
html = (
|
| 19 |
-
"<table border=1>"
|
| 20 |
-
"<tr><td>"
|
| 21 |
-
"<img src='file/workdir/lion.jpg' alt='image One'>"
|
| 22 |
-
"</td>"
|
| 23 |
-
"<td>"
|
| 24 |
-
"imapge caption"
|
| 25 |
-
"</td></tr>"
|
| 26 |
-
"<tr><td>"
|
| 27 |
-
"<img src='file/workdir/cheetah.jpg' alt='image One'>"
|
| 28 |
-
"</td>"
|
| 29 |
-
"<td>"
|
| 30 |
-
"imapge caption"
|
| 31 |
-
"</td></tr>"
|
| 32 |
-
"</table>"
|
| 33 |
-
)
|
| 34 |
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
examples=[
|
| 41 |
-
os.path.join(os.path.dirname(__file__), "workdir/cheetah.jpg"),
|
| 42 |
-
os.path.join(os.path.dirname(__file__), "workdir/lion.jpg"),
|
| 43 |
-
os.path.join(os.path.dirname(__file__), "workdir/logo.png")
|
| 44 |
])
|
| 45 |
|
| 46 |
if __name__ == "__main__":
|
| 47 |
demo.launch()
|
|
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
import os
|
| 3 |
|
| 4 |
|
| 5 |
+
def image_mod(image):
|
| 6 |
+
return image.rotate(45)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
+
demo = gr.Interface(image_mod, gr.Image(type="pil"), "image",
|
| 10 |
+
flagging_options=["blurry", "incorrect", "other"], examples=[
|
| 11 |
+
os.path.join(os.path.dirname(__file__), "images/cheetah1.jpg"),
|
| 12 |
+
os.path.join(os.path.dirname(__file__), "images/lion.jpg"),
|
| 13 |
+
os.path.join(os.path.dirname(__file__), "images/logo.png")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
])
|
| 15 |
|
| 16 |
if __name__ == "__main__":
|
| 17 |
demo.launch()
|
| 18 |
+
|