Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from paintify import stylize_image
|
| 3 |
+
|
| 4 |
+
def process(image):
|
| 5 |
+
output = stylize_image(image)
|
| 6 |
+
return image, output
|
| 7 |
+
|
| 8 |
+
with gr.Blocks(title="MSPaintify") as demo:
|
| 9 |
+
gr.Markdown("## 🎨 MSPaintify: Turn any image into a crude MS Paint-style masterpiece")
|
| 10 |
+
with gr.Row():
|
| 11 |
+
with gr.Column():
|
| 12 |
+
input_img = gr.Image(label="Upload Image", type="pil")
|
| 13 |
+
submit_btn = gr.Button("Convert to MS Paint Style")
|
| 14 |
+
with gr.Column():
|
| 15 |
+
original = gr.Image(label="Original", interactive=False)
|
| 16 |
+
result = gr.Image(label="Stylized", interactive=False)
|
| 17 |
+
download_btn = gr.Button("Download")
|
| 18 |
+
|
| 19 |
+
submit_btn.click(fn=process, inputs=input_img, outputs=[original, result])
|
| 20 |
+
download_btn.click(lambda img: img, inputs=result, outputs=gr.File(label="Download"))
|
| 21 |
+
|
| 22 |
+
demo.launch()
|