aliabd commited on
Commit
0490d45
·
1 Parent(s): 5dcb313

Upload folder using huggingface_hub

Browse files
Files changed (5) hide show
  1. README.md +7 -7
  2. cheetah.jpg +0 -0
  3. requirements.txt +1 -0
  4. run.ipynb +1 -0
  5. run.py +27 -0
README.md CHANGED
@@ -1,12 +1,12 @@
 
1
  ---
2
- title: Image Editor Main
3
- emoji: 📈
4
- colorFrom: red
5
- colorTo: pink
6
  sdk: gradio
7
  sdk_version: 4.4.1
8
- app_file: app.py
9
  pinned: false
 
10
  ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
+
2
  ---
3
+ title: image_editor_main
4
+ emoji: 🔥
5
+ colorFrom: indigo
6
+ colorTo: indigo
7
  sdk: gradio
8
  sdk_version: 4.4.1
9
+ app_file: run.py
10
  pinned: false
11
+ hf_oauth: true
12
  ---
 
 
cheetah.jpg ADDED
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ https://gradio-builds.s3.amazonaws.com/9caddc17b1dea8da1af8ba724c6a5eab04ce0ed8/gradio-4.4.1-py3-none-any.whl
run.ipynb ADDED
@@ -0,0 +1 @@
 
 
1
+ {"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: image_editor"]}, {"cell_type": "code", "execution_count": null, "id": "272996653310673477252411125948039410165", "metadata": {}, "outputs": [], "source": ["!pip install -q gradio "]}, {"cell_type": "code", "execution_count": null, "id": "288918539441861185822528903084949547379", "metadata": {}, "outputs": [], "source": ["# Downloading files from the demo repo\n", "import os\n", "!wget -q https://github.com/gradio-app/gradio/raw/main/demo/image_editor/cheetah.jpg"]}, {"cell_type": "code", "execution_count": null, "id": "44380577570523278879349135829904343037", "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "import time\n", "\n", "\n", "def sleep(im):\n", " time.sleep(5)\n", " return [im[\"background\"], im[\"layers\"][0], im[\"layers\"][1], im[\"composite\"]]\n", "\n", "\n", "with gr.Blocks() as demo:\n", " im = gr.ImageEditor(\n", " type=\"pil\",\n", " crop_size=\"1:1\",\n", " )\n", "\n", " with gr.Group():\n", " with gr.Row():\n", " im_out_1 = gr.Image(type=\"pil\")\n", " im_out_2 = gr.Image(type=\"pil\")\n", " im_out_3 = gr.Image(type=\"pil\")\n", " im_out_4 = gr.Image(type=\"pil\")\n", "\n", " btn = gr.Button()\n", " im.change(sleep, outputs=[im_out_1, im_out_2, im_out_3, im_out_4], inputs=im)\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
run.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import time
3
+
4
+
5
+ def sleep(im):
6
+ time.sleep(5)
7
+ return [im["background"], im["layers"][0], im["layers"][1], im["composite"]]
8
+
9
+
10
+ with gr.Blocks() as demo:
11
+ im = gr.ImageEditor(
12
+ type="pil",
13
+ crop_size="1:1",
14
+ )
15
+
16
+ with gr.Group():
17
+ with gr.Row():
18
+ im_out_1 = gr.Image(type="pil")
19
+ im_out_2 = gr.Image(type="pil")
20
+ im_out_3 = gr.Image(type="pil")
21
+ im_out_4 = gr.Image(type="pil")
22
+
23
+ btn = gr.Button()
24
+ im.change(sleep, outputs=[im_out_1, im_out_2, im_out_3, im_out_4], inputs=im)
25
+
26
+ if __name__ == "__main__":
27
+ demo.launch()