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 "type": "markdown",
9
+ "props": {
10
+ "value": "<h1 style='text-align: center; margin-bottom: 1rem'>Kitchen Sink</h1>",
11
+ "name": "markdown",
12
+ "visible": true,
13
+ "style": {}
14
+ }
15
+ },
16
+ {
17
+ "id": 27,
18
+ "type": "markdown",
19
+ "props": {
20
+ "value": "<p>Try out all the components!</p>",
21
+ "name": "markdown",
22
+ "visible": true,
23
+ "style": {}
24
+ }
25
+ },
26
+ {
27
+ "id": 28,
28
+ "type": "row",
29
+ "props": {
30
+ "type": "row",
31
+ "visible": true,
32
+ "style": {
33
+ "equal_height": false,
34
+ "mobile_collapse": true
35
+ }
36
+ }
37
+ },
38
+ {
39
+ "id": 29,
40
+ "type": "column",
41
+ "props": {
42
+ "type": "column",
43
+ "variant": "panel",
44
+ "visible": true,
45
+ "style": {}
46
+ }
47
+ },
48
+ {
49
+ "id": 30,
50
+ "type": "column",
51
+ "props": {
52
+ "type": "column",
53
+ "variant": "default",
54
+ "visible": true,
55
+ "style": {}
56
+ }
57
+ },
58
+ {
59
+ "id": 0,
60
+ "type": "textbox",
61
+ "props": {
62
+ "lines": 1,
63
+ "max_lines": 20,
64
+ "value": "Lorem ipsum",
65
+ "label": "Textbox",
66
+ "show_label": true,
67
+ "name": "textbox",
68
+ "visible": true,
69
+ "style": {}
70
+ }
71
+ },
72
+ {
73
+ "id": 1,
74
+ "type": "textbox",
75
+ "props": {
76
+ "lines": 3,
77
+ "max_lines": 20,
78
+ "placeholder": "Type here..",
79
+ "value": "",
80
+ "label": "Textbox 2",
81
+ "show_label": true,
82
+ "name": "textbox",
83
+ "visible": true,
84
+ "style": {}
85
+ }
86
+ },
87
+ {
88
+ "id": 2,
89
+ "type": "number",
90
+ "props": {
91
+ "value": 42.0,
92
+ "label": "Number",
93
+ "show_label": true,
94
+ "name": "number",
95
+ "visible": true,
96
+ "style": {}
97
+ }
98
+ },
99
+ {
100
+ "id": 3,
101
+ "type": "slider",
102
+ "props": {
103
+ "minimum": 10,
104
+ "maximum": 20,
105
+ "step": 0.1,
106
+ "value": 15,
107
+ "label": "Slider: 10 - 20",
108
+ "show_label": true,
109
+ "name": "slider",
110
+ "visible": true,
111
+ "style": {}
112
+ }
113
+ },
114
+ {
115
+ "id": 4,
116
+ "type": "slider",
117
+ "props": {
118
+ "minimum": 0,
119
+ "maximum": 20,
120
+ "step": 0.04,
121
+ "value": 0,
122
+ "label": "Slider: step @ 0.04",
123
+ "show_label": true,
124
+ "name": "slider",
125
+ "visible": true,
126
+ "style": {}
127
+ }
128
+ },
129
+ {
130
+ "id": 5,
131
+ "type": "checkbox",
132
+ "props": {
133
+ "value": false,
134
+ "label": "Checkbox",
135
+ "show_label": true,
136
+ "name": "checkbox",
137
+ "visible": true,
138
+ "style": {}
139
+ }
140
+ },
141
+ {
142
+ "id": 6,
143
+ "type": "checkboxgroup",
144
+ "props": {
145
+ "choices": [
146
+ "foo",
147
+ "bar",
148
+ "baz"
149
+ ],
150
+ "value": [
151
+ "foo",
152
+ "bar"
153
+ ],
154
+ "label": "CheckboxGroup",
155
+ "show_label": true,
156
+ "name": "checkboxgroup",
157
+ "visible": true,
158
+ "style": {}
159
+ }
160
+ },
161
+ {
162
+ "id": 7,
163
+ "type": "radio",
164
+ "props": {
165
+ "choices": [
166
+ "foo",
167
+ "bar",
168
+ "baz"
169
+ ],
170
+ "value": "baz",
171
+ "label": "Radio",
172
+ "show_label": true,
173
+ "name": "radio",
174
+ "visible": true,
175
+ "style": {}
176
+ }
177
+ },
178
+ {
179
+ "id": 8,
180
+ "type": "dropdown",
181
+ "props": {
182
+ "choices": [
183
+ "foo",
184
+ "bar",
185
+ "baz"
186
+ ],
187
+ "value": "foo",
188
+ "label": "Dropdown",
189
+ "show_label": true,
190
+ "name": "dropdown",
191
+ "visible": true,
192
+ "style": {}
193
+ }
194
+ },
195
+ {
196
+ "id": 9,
197
+ "type": "image",
198
+ "props": {
199
+ "image_mode": "RGB",
200
+ "source": "upload",
201
+ "tool": "editor",
202
+ "streaming": false,
203
+ "label": "Image",
204
+ "show_label": true,
205
+ "name": "image",
206
+ "visible": true,
207
+ "style": {}
208
+ }
209
+ },
210
+ {
211
+ "id": 10,
212
+ "type": "image",
213
+ "props": {
214
+ "image_mode": "RGB",
215
+ "source": "upload",
216
+ "tool": "select",
217
+ "streaming": false,
218
+ "label": "Image w/ Cropper",
219
+ "show_label": true,
220
+ "name": "image",
221
+ "visible": true,
222
+ "style": {}
223
+ }
224
+ },
225
+ {
226
+ "id": 11,
227
+ "type": "image",
228
+ "props": {
229
+ "image_mode": "RGB",
230
+ "source": "canvas",
231
+ "tool": "editor",
232
+ "streaming": false,
233
+ "label": "Sketchpad",
234
+ "show_label": true,
235
+ "name": "image",
236
+ "visible": true,
237
+ "style": {}
238
+ }
239
+ },
240
+ {
241
+ "id": 12,
242
+ "type": "image",
243
+ "props": {
244
+ "image_mode": "RGB",
245
+ "source": "webcam",
246
+ "tool": "editor",
247
+ "streaming": false,
248
+ "label": "Webcam",
249
+ "show_label": true,
250
+ "name": "image",
251
+ "visible": true,
252
+ "style": {}
253
+ }
254
+ },
255
+ {
256
+ "id": 13,
257
+ "type": "video",
258
+ "props": {
259
+ "source": "upload",
260
+ "label": "Video",
261
+ "show_label": true,
262
+ "name": "video",
263
+ "visible": true,
264
+ "style": {}
265
+ }
266
+ },
267
+ {
268
+ "id": 14,
269
+ "type": "audio",
270
+ "props": {
271
+ "source": "upload",
272
+ "streaming": false,
273
+ "label": "Audio",
274
+ "show_label": true,
275
+ "name": "audio",
276
+ "visible": true,
277
+ "style": {}
278
+ }
279
+ },
280
+ {
281
+ "id": 15,
282
+ "type": "audio",
283
+ "props": {
284
+ "source": "microphone",
285
+ "streaming": false,
286
+ "label": "Microphone",
287
+ "show_label": true,
288
+ "name": "audio",
289
+ "visible": true,
290
+ "style": {}
291
+ }
292
+ },
293
+ {
294
+ "id": 31,
295
+ "type": "row",
296
+ "props": {
297
+ "type": "row",
298
+ "visible": true,
299
+ "style": {
300
+ "mobile_collapse": false
301
+ }
302
+ }
303
+ },
304
+ {
305
+ "id": 32,
306
+ "type": "button",
307
+ "props": {
308
+ "value": "Clear",
309
+ "variant": "secondary",
310
+ "name": "button",
311
+ "visible": true,
312
+ "style": {}
313
+ }
314
+ },
315
+ {
316
+ "id": 33,
317
+ "type": "button",
318
+ "props": {
319
+ "value": "Submit",
320
+ "variant": "primary",
321
+ "name": "button",
322
+ "visible": true,
323
+ "style": {}
324
+ }
325
+ },
326
+ {
327
+ "id": 34,
328
+ "type": "column",
329
+ "props": {
330
+ "type": "column",
331
+ "variant": "panel",
332
+ "visible": true,
333
+ "style": {}
334
+ }
335
+ },
336
+ {
337
+ "id": 35,
338
+ "type": "statustracker",
339
+ "props": {
340
+ "cover_container": true,
341
+ "name": "statustracker",
342
+ "visible": true,
343
+ "style": {}
344
+ }
345
+ },
346
+ {
347
+ "id": 16,
348
+ "type": "textbox",
349
+ "props": {
350
+ "lines": 1,
351
+ "max_lines": 20,
352
+ "value": "",
353
+ "label": "Textbox",
354
+ "show_label": true,
355
+ "interactive": false,
356
+ "name": "textbox",
357
+ "visible": true,
358
+ "style": {}
359
+ }
360
+ },
361
+ {
362
+ "id": 17,
363
+ "type": "label",
364
+ "props": {
365
+ "label": "Label",
366
+ "show_label": true,
367
+ "interactive": false,
368
+ "name": "label",
369
+ "visible": true,
370
+ "style": {}
371
+ }
372
+ },
373
+ {
374
+ "id": 18,
375
+ "type": "audio",
376
+ "props": {
377
+ "source": "upload",
378
+ "streaming": false,
379
+ "label": "Audio",
380
+ "show_label": true,
381
+ "interactive": false,
382
+ "name": "audio",
383
+ "visible": true,
384
+ "style": {}
385
+ }
386
+ },
387
+ {
388
+ "id": 19,
389
+ "type": "image",
390
+ "props": {
391
+ "image_mode": "RGB",
392
+ "source": "upload",
393
+ "tool": "editor",
394
+ "streaming": false,
395
+ "label": "Image",
396
+ "show_label": true,
397
+ "interactive": false,
398
+ "name": "image",
399
+ "visible": true,
400
+ "style": {}
401
+ }
402
+ },
403
+ {
404
+ "id": 20,
405
+ "type": "video",
406
+ "props": {
407
+ "source": "upload",
408
+ "label": "Video",
409
+ "show_label": true,
410
+ "interactive": false,
411
+ "name": "video",
412
+ "visible": true,
413
+ "style": {}
414
+ }
415
+ },
416
+ {
417
+ "id": 21,
418
+ "type": "highlightedtext",
419
+ "props": {
420
+ "color_map": {
421
+ "punc": "pink",
422
+ "test 0": "blue"
423
+ },
424
+ "show_legend": false,
425
+ "label": "HighlightedText",
426
+ "show_label": true,
427
+ "interactive": false,
428
+ "name": "highlightedtext",
429
+ "visible": true,
430
+ "style": {}
431
+ }
432
+ },
433
+ {
434
+ "id": 22,
435
+ "type": "highlightedtext",
436
+ "props": {
437
+ "show_legend": true,
438
+ "label": "HighlightedText",
439
+ "show_label": true,
440
+ "interactive": false,
441
+ "name": "highlightedtext",
442
+ "visible": true,
443
+ "style": {}
444
+ }
445
+ },
446
+ {
447
+ "id": 23,
448
+ "type": "json",
449
+ "props": {
450
+ "label": "JSON",
451
+ "show_label": true,
452
+ "interactive": false,
453
+ "name": "json",
454
+ "visible": true,
455
+ "style": {}
456
+ }
457
+ },
458
+ {
459
+ "id": 24,
460
+ "type": "html",
461
+ "props": {
462
+ "value": "",
463
+ "label": "HTML",
464
+ "show_label": true,
465
+ "interactive": false,
466
+ "name": "html",
467
+ "visible": true,
468
+ "style": {}
469
+ }
470
+ },
471
+ {
472
+ "id": 36,
473
+ "type": "row",
474
+ "props": {
475
+ "type": "row",
476
+ "visible": true,
477
+ "style": {
478
+ "mobile_collapse": false
479
+ }
480
+ }
481
+ },
482
+ {
483
+ "id": 37,
484
+ "type": "button",
485
+ "props": {
486
+ "value": "Flag",
487
+ "variant": "secondary",
488
+ "name": "button",
489
+ "visible": true,
490
+ "style": {}
491
+ }
492
+ },
493
+ {
494
+ "id": 38,
495
+ "type": "dataset",
496
+ "props": {
497
+ "components": [
498
+ "textbox",
499
+ "textbox",
500
+ "number",
501
+ "slider",
502
+ "slider",
503
+ "checkbox",
504
+ "checkboxgroup",
505
+ "radio",
506
+ "dropdown",
507
+ "image",
508
+ "image",
509
+ "image",
510
+ "image",
511
+ "video",
512
+ "audio",
513
+ "audio"
514
+ ],
515
+ "headers": [
516
+ "Textbox",
517
+ "Textbox 2",
518
+ "Number",
519
+ "Slider: 10 - 20",
520
+ "Slider: step @ 0.04",
521
+ "Checkbox",
522
+ "CheckboxGroup",
523
+ "Radio",
524
+ "Dropdown",
525
+ "Image",
526
+ "Image w/ Cropper",
527
+ "Sketchpad",
528
+ "Webcam",
529
+ "Video",
530
+ "Audio",
531
+ "Microphone"
532
+ ],
533
+ "samples": [
534
+ [
535
+ "the quick brown fox",
536
+ "jumps over the lazy dog",
537
+ 10,
538
+ 12,
539
+ 4,
540
+ true,
541
+ [
542
+ "foo",
543
+ "baz"
544
+ ],
545
+ "baz",
546
+ "bar",
547
+ "/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cheetah1.jpg",
548
+ "/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cheetah1.jpg",
549
+ "/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cheetah1.jpg",
550
+ "/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cheetah1.jpg",
551
+ "/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/world.mp4",
552
+ "/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cantina.wav"
553
+ ],
554
+ [
555
+ "the quick brown fox",
556
+ "jumps over the lazy dog",
557
+ 10,
558
+ 12,
559
+ 4,
560
+ true,
561
+ [
562
+ "foo",
563
+ "baz"
564
+ ],
565
+ "baz",
566
+ "bar",
567
+ "/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cheetah1.jpg",
568
+ "/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cheetah1.jpg",
569
+ "/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cheetah1.jpg",
570
+ "/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cheetah1.jpg",
571
+ "/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/world.mp4",
572
+ "/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cantina.wav"
573
+ ],
574
+ [
575
+ "the quick brown fox",
576
+ "jumps over the lazy dog",
577
+ 10,
578
+ 12,
579
+ 4,
580
+ true,
581
+ [
582
+ "foo",
583
+ "baz"
584
+ ],
585
+ "baz",
586
+ "bar",
587
+ "/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cheetah1.jpg",
588
+ "/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cheetah1.jpg",
589
+ "/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cheetah1.jpg",
590
+ "/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cheetah1.jpg",
591
+ "/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/world.mp4",
592
+ "/Users/dawoodkhan/Desktop/Developer/gradio/demo/kitchen_sink/files/cantina.wav"
593
+ ]
594
+ ],
595
+ "type": "index",
596
+ "name": "dataset",
597
+ "visible": true,
598
+ "style": {}
599
+ }
600
+ },
601
+ {
602
+ "id": 39,
603
+ "type": "markdown",
604
+ "props": {
605
+ "value": "<p>Learn more about <a href=\"http://gradio.app\">Gradio</a></p>",
606
+ "name": "markdown",
607
+ "visible": true,
608
+ "style": {}
609
+ }
610
+ }
611
+ ],
612
+ "theme": "default",
613
+ "css": null,
614
+ "enable_queue": false,
615
+ "layout": {
616
+ "id": 25,
617
+ "children": [
618
+ {
619
+ "id": 26
620
+ },
621
+ {
622
+ "id": 27
623
+ },
624
+ {
625
+ "id": 28,
626
+ "children": [
627
+ {
628
+ "id": 29,
629
+ "children": [
630
+ {
631
+ "id": 30,
632
+ "children": [
633
+ {
634
+ "id": 0
635
+ },
636
+ {
637
+ "id": 1
638
+ },
639
+ {
640
+ "id": 2
641
+ },
642
+ {
643
+ "id": 3
644
+ },
645
+ {
646
+ "id": 4
647
+ },
648
+ {
649
+ "id": 5
650
+ },
651
+ {
652
+ "id": 6
653
+ },
654
+ {
655
+ "id": 7
656
+ },
657
+ {
658
+ "id": 8
659
+ },
660
+ {
661
+ "id": 9
662
+ },
663
+ {
664
+ "id": 10
665
+ },
666
+ {
667
+ "id": 11
668
+ },
669
+ {
670
+ "id": 12
671
+ },
672
+ {
673
+ "id": 13
674
+ },
675
+ {
676
+ "id": 14
677
+ },
678
+ {
679
+ "id": 15
680
+ }
681
+ ]
682
+ },
683
+ {
684
+ "id": 31,
685
+ "children": [
686
+ {
687
+ "id": 32
688
+ },
689
+ {
690
+ "id": 33
691
+ }
692
+ ]
693
+ }
694
+ ]
695
+ },
696
+ {
697
+ "id": 34,
698
+ "children": [
699
+ {
700
+ "id": 35
701
+ },
702
+ {
703
+ "id": 16
704
+ },
705
+ {
706
+ "id": 17
707
+ },
708
+ {
709
+ "id": 18
710
+ },
711
+ {
712
+ "id": 19
713
+ },
714
+ {
715
+ "id": 20
716
+ },
717
+ {
718
+ "id": 21
719
+ },
720
+ {
721
+ "id": 22
722
+ },
723
+ {
724
+ "id": 23
725
+ },
726
+ {
727
+ "id": 24
728
+ },
729
+ {
730
+ "id": 36,
731
+ "children": [
732
+ {
733
+ "id": 37
734
+ }
735
+ ]
736
+ }
737
+ ]
738
+ }
739
+ ]
740
+ },
741
+ {
742
+ "id": 38
743
+ },
744
+ {
745
+ "id": 39
746
+ }
747
+ ]
748
+ },
749
+ "dependencies": [
750
+ {
751
+ "targets": [
752
+ 33
753
+ ],
754
+ "trigger": "click",
755
+ "inputs": [
756
+ 0,
757
+ 1,
758
+ 2,
759
+ 3,
760
+ 4,
761
+ 5,
762
+ 6,
763
+ 7,
764
+ 8,
765
+ 9,
766
+ 10,
767
+ 11,
768
+ 12,
769
+ 13,
770
+ 14,
771
+ 15
772
+ ],
773
+ "outputs": [
774
+ 16,
775
+ 17,
776
+ 18,
777
+ 19,
778
+ 20,
779
+ 21,
780
+ 22,
781
+ 23,
782
+ 24
783
+ ],
784
+ "backend_fn": true,
785
+ "js": null,
786
+ "status_tracker": 35,
787
+ "queue": null,
788
+ "api_name": "predict",
789
+ "scroll_to_output": true,
790
+ "show_progress": true,
791
+ "documentation": [
792
+ [
793
+ "(str): text",
794
+ "(str): text",
795
+ "(float | None): numeric input",
796
+ "(number): numeric input",
797
+ "(number): numeric input",
798
+ "(bool): boolean input",
799
+ "(List[str]): list of selected choices",
800
+ "(str): selected choice",
801
+ "(str): selected choice",
802
+ "(str): base64 url data",
803
+ "(str): base64 url data",
804
+ "(str): base64 url data",
805
+ "(str): base64 url data",
806
+ "(Dict[name: str, data: str]): JSON object with filename as 'name' property and base64 data as 'data' property",
807
+ "(Dict[name: str, data: str]): JSON object with filename as 'name' property and base64 data as 'data' property",
808
+ "(Dict[name: str, data: str]): JSON object with filename as 'name' property and base64 data as 'data' property"
809
+ ],
810
+ [
811
+ "(str | None): text",
812
+ "(Dict[label: str, confidences: List[Dict[label: str, confidence: number]]]): Object with key 'label' representing primary label, and key 'confidences' representing a list of label-confidence pairs",
813
+ "(str): base64 url data",
814
+ "(str): base64 url data",
815
+ "(str): base64 url data",
816
+ "(List[Tuple[str, str | number | None]]): List of (word, category) tuples",
817
+ "(List[Tuple[str, str | number | None]]): List of (word, category) tuples",
818
+ "(Dict | List): JSON output",
819
+ null
820
+ ]
821
+ ]
822
+ },
823
+ {
824
+ "targets": [
825
+ 32
826
+ ],
827
+ "trigger": "click",
828
+ "inputs": [],
829
+ "outputs": [
830
+ 0,
831
+ 1,
832
+ 2,
833
+ 3,
834
+ 4,
835
+ 5,
836
+ 6,
837
+ 7,
838
+ 8,
839
+ 9,
840
+ 10,
841
+ 11,
842
+ 12,
843
+ 13,
844
+ 14,
845
+ 15,
846
+ 16,
847
+ 17,
848
+ 18,
849
+ 19,
850
+ 20,
851
+ 21,
852
+ 22,
853
+ 23,
854
+ 24,
855
+ 30
856
+ ],
857
+ "backend_fn": false,
858
+ "js": "() => [\"\", \"\", null, 15, 0, null, [], \"baz\", \"foo\", null, null, null, null, null, null, null, \"\", null, null, null, null, null, null, null, null, {\"variant\": null, \"visible\": true, \"__type__\": \"update\"}]\n ",
859
+ "status_tracker": null,
860
+ "queue": null,
861
+ "api_name": null,
862
+ "scroll_to_output": false,
863
+ "show_progress": true
864
+ },
865
+ {
866
+ "targets": [
867
+ 37
868
+ ],
869
+ "trigger": "click",
870
+ "inputs": [
871
+ 0,
872
+ 1,
873
+ 2,
874
+ 3,
875
+ 4,
876
+ 5,
877
+ 6,
878
+ 7,
879
+ 8,
880
+ 9,
881
+ 10,
882
+ 11,
883
+ 12,
884
+ 13,
885
+ 14,
886
+ 15,
887
+ 16,
888
+ 17,
889
+ 18,
890
+ 19,
891
+ 20,
892
+ 21,
893
+ 22,
894
+ 23,
895
+ 24
896
+ ],
897
+ "outputs": [],
898
+ "backend_fn": true,
899
+ "js": null,
900
+ "status_tracker": null,
901
+ "queue": false,
902
+ "api_name": null,
903
+ "scroll_to_output": false,
904
+ "show_progress": true
905
+ },
906
+ {
907
+ "targets": [
908
+ 38
909
+ ],
910
+ "trigger": "click",
911
+ "inputs": [
912
+ 38
913
+ ],
914
+ "outputs": [
915
+ 0,
916
+ 1,
917
+ 2,
918
+ 3,
919
+ 4,
920
+ 5,
921
+ 6,
922
+ 7,
923
+ 8,
924
+ 9,
925
+ 10,
926
+ 11,
927
+ 12,
928
+ 13,
929
+ 14,
930
+ 15
931
+ ],
932
+ "backend_fn": true,
933
+ "js": null,
934
+ "status_tracker": null,
935
+ "queue": false,
936
+ "api_name": null,
937
+ "scroll_to_output": false,
938
+ "show_progress": true
939
+ }
940
+ ]
941
+ }
demos/kitchen_sink/run.py ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import json
3
+ import numpy as np
4
+ import gradio as gr
5
+
6
+ CHOICES = ["foo", "bar", "baz"]
7
+ JSONOBJ = """{"items":{"item":[{"id": "0001","type": null,"is_good": false,"ppu": 0.55,"batters":{"batter":[{ "id": "1001", "type": "Regular" },{ "id": "1002", "type": "Chocolate" },{ "id": "1003", "type": "Blueberry" },{ "id": "1004", "type": "Devil's Food" }]},"topping":[{ "id": "5001", "type": "None" },{ "id": "5002", "type": "Glazed" },{ "id": "5005", "type": "Sugar" },{ "id": "5007", "type": "Powdered Sugar" },{ "id": "5006", "type": "Chocolate with Sprinkles" },{ "id": "5003", "type": "Chocolate" },{ "id": "5004", "type": "Maple" }]}]}}"""
8
+
9
+ def fn(
10
+ text1,
11
+ text2,
12
+ num,
13
+ slider1,
14
+ slider2,
15
+ single_checkbox,
16
+ checkboxes,
17
+ radio,
18
+ dropdown,
19
+ im1,
20
+ im2,
21
+ im3,
22
+ im4,
23
+ video,
24
+ audio1,
25
+ audio2,
26
+ file,
27
+ df1,
28
+ df2,
29
+ ):
30
+ return (
31
+ (text1 if single_checkbox else text2)
32
+ + ", selected:"
33
+ + ", ".join(checkboxes), # Text
34
+ {
35
+ "positive": num / (num + slider1 + slider2),
36
+ "negative": slider1 / (num + slider1 + slider2),
37
+ "neutral": slider2 / (num + slider1 + slider2),
38
+ }, # Label
39
+ (audio1[0], np.flipud(audio1[1]))
40
+ if audio1 is not None else os.path.join(os.path.dirname(__file__), "files/cantina.wav"), # Audio
41
+ np.flipud(im1)
42
+ if im1 is not None else os.path.join(os.path.dirname(__file__), "files/cheetah1.jpg"), # Image
43
+ video
44
+ if video is not None else os.path.join(os.path.dirname(__file__), "files/world.mp4"), # Video
45
+ [
46
+ ("The", "art"),
47
+ ("quick brown", "adj"),
48
+ ("fox", "nn"),
49
+ ("jumped", "vrb"),
50
+ ("testing testing testing", None),
51
+ ("over", "prp"),
52
+ ("the", "art"),
53
+ ("testing", None),
54
+ ("lazy", "adj"),
55
+ ("dogs", "nn"),
56
+ (".", "punc"),
57
+ ] + [(f"test {x}", f"test {x}") for x in range(10)], # HighlightedText
58
+ [
59
+ ("The testing testing testing", None),
60
+ ("over", 0.6),
61
+ ("the", 0.2),
62
+ ("testing", None),
63
+ ("lazy", -0.1),
64
+ ("dogs", 0.4),
65
+ (".", 0),
66
+ ] + [(f"test", x / 10) for x in range(-10, 10)], # HighlightedText
67
+ json.loads(JSONOBJ), # JSON
68
+ "<button style='background-color: red'>Click Me: " + radio + "</button>", # HTML
69
+ os.path.join(os.path.dirname(__file__), "files/titanic.csv"),
70
+ df1, # Dataframe
71
+ np.random.randint(0, 10, (4, 4)), # Dataframe
72
+ df2, # Timeseries
73
+ )
74
+
75
+
76
+ demo = gr.Interface(
77
+ fn,
78
+ inputs=[
79
+ gr.Textbox(value="Lorem ipsum", label="Textbox"),
80
+ gr.Textbox(lines=3, placeholder="Type here..", label="Textbox 2"),
81
+ gr.Number(label="Number", value=42),
82
+ gr.Slider(10, 20, value=15, label="Slider: 10 - 20"),
83
+ gr.Slider(maximum=20, step=0.04, label="Slider: step @ 0.04"),
84
+ gr.Checkbox(label="Checkbox"),
85
+ gr.CheckboxGroup(label="CheckboxGroup", choices=CHOICES, value=CHOICES[0:2]),
86
+ gr.Radio(label="Radio", choices=CHOICES, value=CHOICES[2]),
87
+ gr.Dropdown(label="Dropdown", choices=CHOICES),
88
+ gr.Image(label="Image"),
89
+ gr.Image(label="Image w/ Cropper", tool="select"),
90
+ gr.Image(label="Sketchpad", source="canvas"),
91
+ gr.Image(label="Webcam", source="webcam"),
92
+ gr.Video(label="Video"),
93
+ gr.Audio(label="Audio"),
94
+ gr.Audio(label="Microphone", source="microphone"),
95
+ gr.File(label="File"),
96
+ gr.Dataframe(label="Dataframe", headers=["Name", "Age", "Gender"]),
97
+ gr.Timeseries(x="time", y=["price", "value"], colors=["pink", "purple"]),
98
+ ],
99
+ outputs=[
100
+ gr.Textbox(label="Textbox"),
101
+ gr.Label(label="Label"),
102
+ gr.Audio(label="Audio"),
103
+ gr.Image(label="Image"),
104
+ gr.Video(label="Video"),
105
+ gr.HighlightedText(label="HighlightedText", color_map={"punc": "pink", "test 0": "blue"}),
106
+ gr.HighlightedText(label="HighlightedText", show_legend=True),
107
+ gr.JSON(label="JSON"),
108
+ gr.HTML(label="HTML"),
109
+ gr.File(label="File"),
110
+ gr.Dataframe(label="Dataframe"),
111
+ gr.Dataframe(label="Numpy"),
112
+ gr.Timeseries(x="time", y=["price", "value"], label="Timeseries"),
113
+ ],
114
+ examples=[
115
+ [
116
+ "the quick brown fox",
117
+ "jumps over the lazy dog",
118
+ 10,
119
+ 12,
120
+ 4,
121
+ True,
122
+ ["foo", "baz"],
123
+ "baz",
124
+ "bar",
125
+ os.path.join(os.path.dirname(__file__), "files/cheetah1.jpg"),
126
+ os.path.join(os.path.dirname(__file__), "files/cheetah1.jpg"),
127
+ os.path.join(os.path.dirname(__file__), "files/cheetah1.jpg"),
128
+ os.path.join(os.path.dirname(__file__), "files/cheetah1.jpg"),
129
+ os.path.join(os.path.dirname(__file__), "files/world.mp4"),
130
+ os.path.join(os.path.dirname(__file__), "files/cantina.wav"),
131
+ os.path.join(os.path.dirname(__file__), "files/cantina.wav"),
132
+ os.path.join(os.path.dirname(__file__), "files/titanic.csv"),
133
+ [[1, 2, 3], [3, 4, 5]],
134
+ os.path.join(os.path.dirname(__file__), "files/time.csv"),
135
+ ]
136
+ ]
137
+ * 3,
138
+ theme="default",
139
+ title="Gradio AI UI UX",
140
+ cache_examples=False,
141
+ description="Try out all the components!",
142
+ article="Learn more about [Gradio](http://gradio.app)",
143
+ )
144
+
145
+ if __name__ == "__main__":
146
+ demo.launch()