Spaces:
Sleeping
Sleeping
Upload with huggingface_hub
Browse files- README.md +5 -6
- files/cheetah1.jpg +0 -0
- requirements.txt +1 -0
- run.py +58 -0
README.md
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
colorTo: indigo
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 3.6
|
| 8 |
-
app_file:
|
| 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_main
|
| 4 |
+
emoji: 馃敟
|
| 5 |
+
colorFrom: indigo
|
| 6 |
colorTo: indigo
|
| 7 |
sdk: gradio
|
| 8 |
sdk_version: 3.6
|
| 9 |
+
app_file: run.py
|
| 10 |
pinned: false
|
| 11 |
---
|
|
|
|
|
|
files/cheetah1.jpg
ADDED
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
https://gradio-main-build.s3.amazonaws.com/c3bec6153737855510542e8154391f328ac72606/gradio-3.6-py3-none-any.whl
|
run.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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.Box():
|
| 30 |
+
with gr.Row().style(equal_height=True):
|
| 31 |
+
|
| 32 |
+
text = gr.Textbox(
|
| 33 |
+
label="Enter your prompt", show_label=False, max_lines=1
|
| 34 |
+
).style(
|
| 35 |
+
border=(True, False, True, True),
|
| 36 |
+
rounded=(True, False, False, True),
|
| 37 |
+
container=False,
|
| 38 |
+
)
|
| 39 |
+
btn = gr.Button("Run").style(
|
| 40 |
+
margin=False,
|
| 41 |
+
rounded=(False, True, True, False),
|
| 42 |
+
)
|
| 43 |
+
gallery = gr.Gallery(label="Generated images", show_label=False).style(
|
| 44 |
+
grid=(
|
| 45 |
+
1,
|
| 46 |
+
3,
|
| 47 |
+
),
|
| 48 |
+
height="auto",
|
| 49 |
+
)
|
| 50 |
+
btn.click(img, inputs=text, outputs=gallery)
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
if __name__ == "__main__":
|
| 54 |
+
demo.launch()
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
# margin = (TOP, RIGHT, BOTTOM, LEFT)
|
| 58 |
+
# rounded = (TOPLEFT, TOPRIGHT, BOTTOMRIGHT, BOTTOMLEFT)
|