mirror of
https://github.com/gradio-app/gradio.git
synced 2024-11-21 01:01:05 +08:00
a4aa6a2cb9
* adding gallery * added netlify files * new navbar design * header section new design * used by section new design * cards section new design * integrates with section new design * customer stories section new design * footer and gradient * demos section new design * docs fixes * docs reorg * docs reorg * upgrading to tailwind 3 * tailwind config changes * navbar new design * fixing body on all pages * Updating Guides (#1012) * updating getting started * updated codecov version * tweaks to gs * added netlify file * added netlify file * website prebuild script * increased code size * blocks * edits * blocks_hello * hello world * guide * merge main * added flipper demo * guide * guide * add guides * tweak to refresh website * header section new design * demos section new design * cards design * used by section * tweets section * footer on all pages * mobile responsive fixes * mobile responsive fixes * https fonts * completed blocks guide * unify components * minor tweaks * docs headers styling and navigation pane * parameter code blocks * styling description and input type * parameter tables and other styling * only documenting interactive components when possible * guides * embedding not working * demos not working * fixing demo code * fixing demos * demo fix * updated demos * updated demos * ui update * updated docstrings * updated code snippets so they run * updating docs * Interface docs * updating interface * fixing parameters in interface.py * required and defaults for interface, and styling * fixing up interface (#1207) * fixing up interface * fixed interface methods * formatting * updating interface docs * updating interface docs * formatting * docstring to load from docstrings * fixed colors * finalize interface content * interface examples * fixed examples * added some blocks docs * blocks * component fixes * reorganized some files (#1210) * formatting * added info for every component * fixes * blocks docs * added blocks demos * adding combined interfaces * added parallel, series * Doc: layout update (#1216) * doc layout * home spacing Co-authored-by: Abubakar Abid <abubakar@huggingface.co> * adding layouts * layouts done * added events for components * formatting and https * brings back dropdown and other components * fix header ids * moved ids and fixed nav * added parameters for remaining component * docstring fixes * landing page demos * demo window placeholder * demo nav * fixed test * formatting * demo code * correctly importing gradio css/js * remove keyvalues * modify launch script to move gradio assetS * components embedded test * correct demo name * hide try demo and embedding * local devserver changes * create embedding json with configs * changes * fixes * comment out layout docs * demo work * demo fixes * demo embedding fixes * typo * jinja fix * demo nav fix * hide demo button * formatting * removed whitespace * remove newline from parameter * styling demo window * copy work * hide demo buttons * remove index * remove layouts from docs * remove merge artifact * merge dockerfile * chagnes * changes * changes * changes * styling demo window * revert most things * whoops * chagnes * changes * changes * changes * changes * changes * changes * format * changes * fixed Dataset docstring * fix component signature and add required * adding string shortcuts * fix small issues parameter docstringss * string shortcuts * fixed gallery and label values * added for remaining parameters * formatting * extended embedded components * typo * remove capitalization from embeddings * try examples button * added demos for blocks and combining interfaces * demos styling * homepage update (#1275) * spacing * remove console.log * demo window fixes * new spaces * shorten codeblock width * fix plot * better string shortcuts * add embedding config for json * remove console log Co-authored-by: Abubakar Abid <abubakar@huggingface.co> Co-authored-by: aliabd <ali.si3luwa@gmail.com> Co-authored-by: Victor Muštar <victor.mustar@gmail.com>
62 lines
2.3 KiB
Python
62 lines
2.3 KiB
Python
# This demo needs to be run from the repo folder.
|
|
# python demo/fake_gan/run.py
|
|
import os
|
|
import random
|
|
import time
|
|
|
|
import gradio as gr
|
|
|
|
|
|
def fake_gan(count, *args):
|
|
time.sleep(1)
|
|
images = [
|
|
random.choice(
|
|
[
|
|
"https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=387&q=80",
|
|
"https://images.unsplash.com/photo-1554151228-14d9def656e4?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=386&q=80",
|
|
"https://images.unsplash.com/photo-1542909168-82c3e7fdca5c?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MXx8aHVtYW4lMjBmYWNlfGVufDB8fDB8fA%3D%3D&w=1000&q=80",
|
|
"https://images.unsplash.com/photo-1546456073-92b9f0a8d413?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=387&q=80",
|
|
"https://images.unsplash.com/photo-1601412436009-d964bd02edbc?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=464&q=80",
|
|
]
|
|
)
|
|
for _ in range(int(count))
|
|
]
|
|
return images
|
|
|
|
|
|
cheetah = os.path.join(os.path.dirname(__file__), "files/cheetah1.jpg")
|
|
|
|
demo = gr.Interface(
|
|
fn=fake_gan,
|
|
inputs=[
|
|
gr.Number(label="Generation Count"),
|
|
gr.Image(label="Initial Image (optional)"),
|
|
gr.Slider(0, 50, 25, label="TV_scale (for smoothness)"),
|
|
gr.Slider(0, 50, 25, label="Range_Scale (out of range RBG)"),
|
|
gr.Number(label="Seed"),
|
|
gr.Number(label="Respacing"),
|
|
],
|
|
outputs=gr.Gallery(label="Generated Images"),
|
|
title="FD-GAN",
|
|
description="This is a fake demo of a GAN. In reality, the images are randomly chosen from Unsplash.",
|
|
examples=[
|
|
[2, cheetah, 12, 12, 4, 4],
|
|
[2, cheetah, 12, 12, 4, 4],
|
|
[2, cheetah, 12, 12, 4, 4],
|
|
[2, cheetah, 12, 12, 4, 4],
|
|
[2, cheetah, 12, 12, 4, 4],
|
|
[2, cheetah, 12, 12, 4, 4],
|
|
[2, cheetah, 12, 12, 4, 4],
|
|
[2, cheetah, 12, 12, 4, 4],
|
|
[2, cheetah, 12, 12, 4, 4],
|
|
[2, cheetah, 12, 12, 4, 4],
|
|
[2, cheetah, 12, 12, 4, 4],
|
|
[2, cheetah, 12, 12, 4, 4],
|
|
[2, cheetah, 12, 12, 4, 4],
|
|
[2, cheetah, 12, 12, 4, 4],
|
|
],
|
|
)
|
|
|
|
if __name__ == "__main__":
|
|
demo.launch()
|