mirror of
https://github.com/gradio-app/gradio.git
synced 2025-03-07 11:46:51 +08:00
* py * path * barebones js * add changeset * add changeset * downloadbutton * add changeset * changes * clog * commit * revert' * fix * js * add changeset * cleanup * download * notebooks * stories * change * fix * format * download * Fix updating `icon` parameter (bug resulting from https://github.com/gradio-app/gradio/pull/7528) (#7554) * fetch 2 * fix --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2.1 KiB
2.1 KiB
Gradio Demo: fake_gan¶
This is a fake GAN that shows how to create a text-to-image interface for image generation. Check out the Stable Diffusion demo for more: https://hf.co/spaces/stabilityai/stable-diffusion/¶
In [ ]:
!pip install -q gradio
In [ ]:
# This demo needs to be run from the repo folder. # python demo/fake_gan/run.py import random import gradio as gr def fake_gan(): images = [ (random.choice( [ "http://www.marketingtool.online/en/face-generator/img/faces/avatar-1151ce9f4b2043de0d2e3b7826127998.jpg", "http://www.marketingtool.online/en/face-generator/img/faces/avatar-116b5e92936b766b7fdfc242649337f7.jpg", "http://www.marketingtool.online/en/face-generator/img/faces/avatar-1163530ca19b5cebe1b002b8ec67b6fc.jpg", "http://www.marketingtool.online/en/face-generator/img/faces/avatar-1116395d6e6a6581eef8b8038f4c8e55.jpg", "http://www.marketingtool.online/en/face-generator/img/faces/avatar-11319be65db395d0e8e6855d18ddcef0.jpg", ] ), f"label {i}") for i in range(3) ] return images with gr.Blocks() as demo: gallery = gr.Gallery( label="Generated images", show_label=False, elem_id="gallery" , columns=[3], rows=[1], object_fit="contain", height="auto") btn = gr.Button("Generate images", scale=0) btn.click(fake_gan, None, gallery) if __name__ == "__main__": demo.launch()