mirror of
https://github.com/gradio-app/gradio.git
synced 2024-11-27 01:40:20 +08:00
92278729ee
* Add code * add changeset * Use urls from our s3 bucket * Add notebook code --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
25 lines
749 B
Python
25 lines
749 B
Python
import gradio as gr
|
|
|
|
with gr.Blocks() as demo:
|
|
cheetahs = [
|
|
"https://gradio-builds.s3.amazonaws.com/assets/cheetah-003.jpg",
|
|
"https://gradio-builds.s3.amazonaws.com/assets/lite-logo.png",
|
|
"https://gradio-builds.s3.amazonaws.com/assets/TheCheethcat.jpg",
|
|
]
|
|
with gr.Row():
|
|
with gr.Column():
|
|
btn = gr.Button()
|
|
with gr.Column():
|
|
gallery = gr.Gallery()
|
|
with gr.Column():
|
|
select_output = gr.Textbox(label="Select Data")
|
|
btn.click(lambda: cheetahs, None, [gallery])
|
|
|
|
def select(select_data: gr.SelectData):
|
|
return select_data.value['image']['url']
|
|
|
|
gallery.select(select, None, select_output)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
demo.launch() |