mirror of
https://github.com/gradio-app/gradio.git
synced 2025-01-30 11:00:11 +08:00
9b42ba8f10
* changes * changes * revert changes * changes * add changeset * notebooks script * changes * changes --------- Co-authored-by: Ali Abid <aliabid94@gmail.com> Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com> Co-authored-by: Ali Abdalla <ali.si3luwa@gmail.com>
47 lines
1.2 KiB
Python
47 lines
1.2 KiB
Python
from time import sleep
|
|
import gradio as gr
|
|
import os
|
|
|
|
cheetah = os.path.join(os.path.dirname(__file__), "files/cheetah1.jpg")
|
|
|
|
def img(text):
|
|
sleep(3)
|
|
return [
|
|
cheetah,
|
|
cheetah,
|
|
cheetah,
|
|
cheetah,
|
|
cheetah,
|
|
cheetah,
|
|
cheetah,
|
|
cheetah,
|
|
cheetah,
|
|
]
|
|
|
|
with gr.Blocks(css=".container { max-width: 800px; margin: auto; }") as demo:
|
|
gr.Markdown("<h1><center>DALL·E mini</center></h1>")
|
|
gr.Markdown(
|
|
"DALL·E mini is an AI model that generates images from any prompt you give!"
|
|
)
|
|
with gr.Group():
|
|
with gr.Row(equal_height=True):
|
|
text = gr.Textbox(
|
|
label="Enter your prompt",
|
|
max_lines=1,
|
|
container=False,
|
|
)
|
|
btn = gr.Button("Run", scale=0)
|
|
gallery = gr.Gallery(
|
|
label="Generated images",
|
|
show_label=False,
|
|
columns=(1, 3),
|
|
height="auto",
|
|
)
|
|
btn.click(img, inputs=text, outputs=gallery)
|
|
|
|
if __name__ == "__main__":
|
|
demo.launch()
|
|
|
|
# margin = (TOP, RIGHT, BOTTOM, LEFT)
|
|
# rounded = (TOPLEFT, TOPRIGHT, BOTTOMRIGHT, BOTTOMLEFT)
|