ysharma HF Staff commited on
Commit
6f02f5d
·
verified ·
1 Parent(s): ba33199

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -28
app.py CHANGED
@@ -1,35 +1,27 @@
1
  import gradio as gr
2
 
3
- with gr.Blocks() as demo1:
4
- show_box = gr.Checkbox()
5
-
6
- @gr.render(inputs=show_box)
7
- def render(show_box):
8
- if show_box:
9
- textbox = gr.Textbox()
10
- textbox2 = gr.Textbox()
11
- textbox.change(lambda x:x, textbox, textbox2)
12
- else:
13
- gr.Markdown("Hidden textbox")
14
-
15
- #demo.launch(debug=True)
16
-
17
- import gradio as gr
18
-
19
  def predict(*args):
20
  print(args)
21
- return {"inputs": list(args)}
22
 
23
  with gr.Blocks() as demo:
24
- s = gr.Slider(1, 4, step=1, interactive=True)
25
 
26
- @gr.render(inputs=s, triggers=[s.change])
27
- def render(num):
28
- texts = []
29
- with gr.Row():
30
- for i in range(num):
31
- texts.append(gr.Textbox())
32
- json = gr.JSON()
33
- btn = gr.Button("RUN")
34
- btn.click(fn=predict, inputs=texts, outputs=json)
35
- demo.launch(debug=True)
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  def predict(*args):
4
  print(args)
5
+ return {"inputs": list[args]}
6
 
7
  with gr.Blocks() as demo:
8
+ s = gr.CheckboxGroup(choices=['Text-to-Image', 'Image-to-Image'],value='Text-to-Image', interactive=True)
9
 
10
+ @gr.render(inputs=s, triggers=[s.input])
11
+ def render(value):
12
+ #texts = []
13
+ for Mode in value:
14
+ with gr.Tab(label=Mode):
15
+ if value=='Text-to-Image':
16
+ gr.Markdown(value=Mode)
17
+ gr.load('minimaxir/sdxl-wrong-lora', src='models') #.launch(debug=True, quiet=True) #minimaxir/sdxl-wrong-lora stabilityai/sdxl-turbo ByteDance/SDXL-Lightning
18
+ else:
19
+ gr.Markdown(value=Mode)
20
+ gr.load('stabilityai/stable-diffusion-xl-refiner-1.0', src='models') #.launch(height=1000, quiet=True)
21
+ #with gr.Row():
22
+ #for i in range(num):
23
+ #texts.append(gr.Textbox())
24
+ #json = gr.JSON()
25
+ #btn = gr.Button("RUN")
26
+ #btn.click(fn=predict, inputs=texts, outputs=json)
27
+ demo.launch(debug=True, quiet=True)