aliabd commited on
Commit
a26a3ac
1 Parent(s): b2eb6bf

Upload folder using huggingface_hub

Browse files
Files changed (4) hide show
  1. README.md +8 -8
  2. files/cheetah1.jpg +0 -0
  3. run.ipynb +1 -0
  4. run.py +50 -0
README.md CHANGED
@@ -1,12 +1,12 @@
 
1
  ---
2
- title: Blocks Joined 3-x
3
- emoji: 馃搲
4
- colorFrom: blue
5
- colorTo: purple
6
  sdk: gradio
7
- sdk_version: 4.3.0
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: blocks_joined_3-x
4
+ emoji: 馃敟
5
+ colorFrom: indigo
6
+ colorTo: indigo
7
  sdk: gradio
8
+ sdk_version: 3.50.1
9
+ app_file: run.py
10
  pinned: false
11
+ hf_oauth: true
12
  ---
 
 
files/cheetah1.jpg ADDED
run.ipynb ADDED
@@ -0,0 +1 @@
 
 
1
+ {"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: blocks_joined"]}, {"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", "os.mkdir('files')\n", "!wget -q -O files/cheetah1.jpg https://github.com/gradio-app/gradio/raw/main/demo/blocks_joined/files/cheetah1.jpg"]}, {"cell_type": "code", "execution_count": null, "id": "44380577570523278879349135829904343037", "metadata": {}, "outputs": [], "source": ["from time import sleep\n", "import gradio as gr\n", "import os\n", "\n", "cheetah = os.path.join(os.path.abspath(''), \"files/cheetah1.jpg\")\n", "\n", "\n", "def img(text):\n", " sleep(3)\n", " return [\n", " cheetah,\n", " cheetah,\n", " cheetah,\n", " cheetah,\n", " cheetah,\n", " cheetah,\n", " cheetah,\n", " cheetah,\n", " cheetah,\n", " ]\n", "\n", "\n", "with gr.Blocks(css=\".container { max-width: 800px; margin: auto; }\") as demo:\n", " gr.Markdown(\"<h1><center>DALL\u00b7E mini</center></h1>\")\n", " gr.Markdown(\n", " \"DALL\u00b7E mini is an AI model that generates images from any prompt you give!\"\n", " )\n", " with gr.Group():\n", " with gr.Row(equal_height=True):\n", " text = gr.Textbox(\n", " label=\"Enter your prompt\",\n", " max_lines=1,\n", " container=False,\n", " )\n", " btn = gr.Button(\"Run\", scale=0)\n", " gallery = gr.Gallery(\n", " label=\"Generated images\",\n", " show_label=False,\n", " columns=(1, 3),\n", " height=\"auto\",\n", " )\n", " btn.click(img, inputs=text, outputs=gallery)\n", "\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n", "\n", "\n", "# margin = (TOP, RIGHT, BOTTOM, LEFT)\n", "# rounded = (TOPLEFT, TOPRIGHT, BOTTOMRIGHT, BOTTOMLEFT)\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
run.py ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from time import sleep
2
+ import gradio as gr
3
+ import os
4
+
5
+ cheetah = os.path.join(os.path.dirname(__file__), "files/cheetah1.jpg")
6
+
7
+
8
+ def img(text):
9
+ sleep(3)
10
+ return [
11
+ cheetah,
12
+ cheetah,
13
+ cheetah,
14
+ cheetah,
15
+ cheetah,
16
+ cheetah,
17
+ cheetah,
18
+ cheetah,
19
+ cheetah,
20
+ ]
21
+
22
+
23
+ with gr.Blocks(css=".container { max-width: 800px; margin: auto; }") as demo:
24
+ gr.Markdown("<h1><center>DALL路E mini</center></h1>")
25
+ gr.Markdown(
26
+ "DALL路E mini is an AI model that generates images from any prompt you give!"
27
+ )
28
+ with gr.Group():
29
+ with gr.Row(equal_height=True):
30
+ text = gr.Textbox(
31
+ label="Enter your prompt",
32
+ max_lines=1,
33
+ container=False,
34
+ )
35
+ btn = gr.Button("Run", scale=0)
36
+ gallery = gr.Gallery(
37
+ label="Generated images",
38
+ show_label=False,
39
+ columns=(1, 3),
40
+ height="auto",
41
+ )
42
+ btn.click(img, inputs=text, outputs=gallery)
43
+
44
+
45
+ if __name__ == "__main__":
46
+ demo.launch()
47
+
48
+
49
+ # margin = (TOP, RIGHT, BOTTOM, LEFT)
50
+ # rounded = (TOPLEFT, TOPRIGHT, BOTTOMRIGHT, BOTTOMLEFT)