bryanzhou008 commited on
Commit
0313ee9
·
verified ·
1 Parent(s): 3522874

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -3,6 +3,11 @@ import gradio as gr
3
  from src.v2_for_hf import generate_images
4
  from src.v2_for_hf import NUM_GEN
5
 
 
 
 
 
 
6
  iface = gr.Interface(
7
  fn=generate_images,
8
  inputs=[
@@ -11,10 +16,9 @@ iface = gr.Interface(
11
  gr.Textbox(label="Mistaken Class"),
12
  gr.Textbox(label="Ground Truth Class")
13
  ],
14
- outputs=[
15
- gr.Image(label="Output Image") for i in range(NUM_GEN)
16
- ],
17
  title="visual-data-aug",
 
18
  )
19
 
20
  if __name__ == "__main__":
 
3
  from src.v2_for_hf import generate_images
4
  from src.v2_for_hf import NUM_GEN
5
 
6
+
7
+ def dynamic_label(api_key, input_image, mistaken_class, ground_truth_class):
8
+ return [gr.Image(label=f"Generated Image of {ground_truth_class}") for _ in range(NUM_GEN)]
9
+
10
+
11
  iface = gr.Interface(
12
  fn=generate_images,
13
  inputs=[
 
16
  gr.Textbox(label="Mistaken Class"),
17
  gr.Textbox(label="Ground Truth Class")
18
  ],
19
+ outputs=dynamic_label,
 
 
20
  title="visual-data-aug",
21
+ live=True,
22
  )
23
 
24
  if __name__ == "__main__":