SeemG commited on
Commit
0aeac2d
·
verified ·
1 Parent(s): 9fb43f1

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -0
app.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import random
2
+
3
+ import gradio as gr
4
+
5
+
6
+ def fake_gan():
7
+ fileName = display_cifar_misclassified_data(misclassified_data, classes, inv_normalize, number_of_samples=5)
8
+
9
+ images = [
10
+ (random.choice(
11
+ [
12
+ display_cifar_misclassified_data(misclassified_data, classes, inv_normalize, number_of_samples=5),
13
+ Image.open(fileName)
14
+ ]
15
+ ), f"label {i}")
16
+ for i in range(3)
17
+ ]
18
+ return images
19
+
20
+
21
+
22
+ with gr.Blocks() as demo:
23
+ gallery = gr.Gallery(
24
+ label="Generated images", show_label=False, elem_id="gallery"
25
+ , columns=[3], rows=[1], object_fit="contain", height="auto")
26
+ btn = gr.Button("Generate images", scale=0)
27
+
28
+ btn.click(fake_gan, None, gallery)
29
+
30
+ if __name__ == "__main__":
31
+ demo.launch()