22# python demo/fake_gan/run.py
33import os
44import random
5- import time
65
76import gradio as gr
87
@@ -25,7 +24,7 @@ def fake_gan(count, *args):
2524
2625cheetah = os .path .join (os .path .dirname (__file__ ), "files/cheetah1.jpg" )
2726
28- no_cache_examples = gr .Interface (
27+ demo = gr .Interface (
2928 fn = fake_gan ,
3029 inputs = [
3130 gr .Number (label = "Generation Count" ),
@@ -46,34 +45,7 @@ def fake_gan(count, *args):
4645 [4 , cheetah , None , 11 , None , None ],
4746 [3 , cheetah , None , 1 , None , None ],
4847 ],
49- cache_examples = False
5048)
5149
52- cache_examples = gr .Interface (
53- fn = fake_gan ,
54- inputs = [
55- gr .Number (label = "Generation Count" ),
56- gr .Image (label = "Initial Image (optional)" ),
57- gr .Slider (0 , 50 , 25 , label = "TV_scale (for smoothness)" ),
58- gr .Slider (0 , 50 , 25 , label = "Range_Scale (out of range RBG)" ),
59- gr .Number (label = "Seed" ),
60- gr .Number (label = "Respacing" ),
61- ],
62- outputs = gr .Gallery (label = "Generated Images" ),
63- title = "FD-GAN" ,
64- description = "This is a fake demo of a GAN. In reality, the images are randomly chosen from Unsplash." ,
65- examples = [
66- [2 , cheetah , 1 , 12 , 1 , 1 ],
67- [1 , cheetah , 2 , 2 , 2 , 2 ],
68- [4 , cheetah , 3 , 42 , 3 , 3 ],
69- [5 , cheetah , 4 , 23 , 4 , 4 ],
70- [4 , cheetah , 5 , 11 , 5 , 5 ],
71- [3 , cheetah , 6 , 1 , 6 , 6 ],
72- ],
73- cache_examples = True
74- )
75-
76- demo = gr .TabbedInterface ([no_cache_examples , cache_examples ])
77-
7850if __name__ == "__main__" :
7951 demo .launch ()
0 commit comments