awacke1 commited on
Commit
2ebdd7c
·
1 Parent(s): 594ac32

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -32
app.py CHANGED
@@ -18,8 +18,10 @@ CHOICES = ["foo", "bar", "baz"]
18
  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" }]}]}}"""
19
 
20
 
21
- def fn( text1, text2, num, slider1, slider2, single_checkbox, checkboxes, radio, dropdown, im1, im2, im3, im4,
22
- video, audio1, audio2, file, df1, df2,):
 
 
23
  return (
24
  (text1 if single_checkbox else text2) + ", selected:" + ", ".join(checkboxes), # Text
25
  {"positive": num / (num + slider1 + slider2),"negative": slider1 / (num + slider1 + slider2),"neutral": slider2 / (num + slider1 + slider2),}, # Label
@@ -62,20 +64,20 @@ demo = gr.Interface(
62
  inputs=[
63
  gr.Textbox(value="Lorem ipsum", label="Textbox"),
64
  gr.Textbox(lines=3, placeholder="Type here..", label="Textbox 2"),
65
- gr.Number(label="Number", value=42),
66
- gr.Slider(10, 20, value=15, label="Slider: 10 - 20"),
67
- gr.Slider(maximum=20, step=0.04, label="Slider: step @ 0.04"),
68
- gr.Checkbox(label="Checkbox"),
69
- gr.CheckboxGroup(label="CheckboxGroup", choices=CHOICES, value=CHOICES[0:2]),
70
- gr.Radio(label="Radio", choices=CHOICES, value=CHOICES[2]),
71
- gr.Dropdown(label="Dropdown", choices=CHOICES),
72
- gr.Image(label="Image"),
73
- gr.Image(label="Image w/ Cropper", tool="select"),
74
- gr.Image(label="Sketchpad", source="canvas"),
75
  gr.Image(label="Webcam", source="webcam"),
76
- gr.Video(label="Video"),
77
- gr.Audio(label="Audio"),
78
- gr.Audio(label="Microphone", source="microphone"),
79
  gr.File(label="File"),
80
  gr.Dataframe(label="Dataframe", headers=["Name", "Age", "Gender"]),
81
  gr.Timeseries(x="time", y=["price", "value"], colors=["pink", "purple"]),
@@ -83,13 +85,13 @@ demo = gr.Interface(
83
  outputs=[
84
  gr.Textbox(label="Textbox"),
85
  gr.Label(label="Label"),
86
- gr.Audio(label="Audio"),
87
- gr.Image(label="Image"),
88
- gr.Video(label="Video"),
89
  gr.HighlightedText(label="HighlightedText", color_map={"punc": "pink", "test 0": "blue"}),
90
  gr.HighlightedText(label="HighlightedText", show_legend=True),
91
  gr.JSON(label="JSON"),
92
- gr.HTML(label="HTML"),
93
  gr.File(label="File"),
94
  gr.Dataframe(label="Dataframe"),
95
  gr.Dataframe(label="Numpy"),
@@ -99,20 +101,20 @@ demo = gr.Interface(
99
  [
100
  "the quick brown fox",
101
  "jumps over the lazy dog",
102
- 10,
103
- 12,
104
- 4,
105
- True,
106
- ["foo", "baz"],
107
- "baz",
108
- "bar",
 
 
 
109
  os.path.join(os.path.dirname(__file__), "files/cheetah1.jpg"),
110
- os.path.join(os.path.dirname(__file__), "files/cheetah1.jpg"),
111
- os.path.join(os.path.dirname(__file__), "files/cheetah1.jpg"),
112
- os.path.join(os.path.dirname(__file__), "files/cheetah1.jpg"),
113
- os.path.join(os.path.dirname(__file__), "files/world.mp4"),
114
- os.path.join(os.path.dirname(__file__), "files/cantina.wav"),
115
- os.path.join(os.path.dirname(__file__), "files/cantina.wav"),
116
  os.path.join(os.path.dirname(__file__), "files/titanic.csv"),
117
  [[1, 2, 3], [3, 4, 5]],
118
  os.path.join(os.path.dirname(__file__), "files/time.csv"),
 
18
  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" }]}]}}"""
19
 
20
 
21
+ #def fn( text1, text2, num, slider1, slider2, single_checkbox, checkboxes, radio, dropdown, im1, im2, im3, im4,
22
+ # video, audio1, audio2, file, df1, df2,):
23
+ def fn( text1, text2, im4, file, df1, df2,):
24
+
25
  return (
26
  (text1 if single_checkbox else text2) + ", selected:" + ", ".join(checkboxes), # Text
27
  {"positive": num / (num + slider1 + slider2),"negative": slider1 / (num + slider1 + slider2),"neutral": slider2 / (num + slider1 + slider2),}, # Label
 
64
  inputs=[
65
  gr.Textbox(value="Lorem ipsum", label="Textbox"),
66
  gr.Textbox(lines=3, placeholder="Type here..", label="Textbox 2"),
67
+ #gr.Number(label="Number", value=42),
68
+ #gr.Slider(10, 20, value=15, label="Slider: 10 - 20"),
69
+ #gr.Slider(maximum=20, step=0.04, label="Slider: step @ 0.04"),
70
+ #gr.Checkbox(label="Checkbox"),
71
+ #gr.CheckboxGroup(label="CheckboxGroup", choices=CHOICES, value=CHOICES[0:2]),
72
+ #gr.Radio(label="Radio", choices=CHOICES, value=CHOICES[2]),
73
+ #gr.Dropdown(label="Dropdown", choices=CHOICES),
74
+ #gr.Image(label="Image"),
75
+ #gr.Image(label="Image w/ Cropper", tool="select"),
76
+ #gr.Image(label="Sketchpad", source="canvas"),
77
  gr.Image(label="Webcam", source="webcam"),
78
+ #gr.Video(label="Video"),
79
+ #gr.Audio(label="Audio"),
80
+ #gr.Audio(label="Microphone", source="microphone"),
81
  gr.File(label="File"),
82
  gr.Dataframe(label="Dataframe", headers=["Name", "Age", "Gender"]),
83
  gr.Timeseries(x="time", y=["price", "value"], colors=["pink", "purple"]),
 
85
  outputs=[
86
  gr.Textbox(label="Textbox"),
87
  gr.Label(label="Label"),
88
+ #gr.Audio(label="Audio"),
89
+ #gr.Image(label="Image"),
90
+ #gr.Video(label="Video"),
91
  gr.HighlightedText(label="HighlightedText", color_map={"punc": "pink", "test 0": "blue"}),
92
  gr.HighlightedText(label="HighlightedText", show_legend=True),
93
  gr.JSON(label="JSON"),
94
+ #gr.HTML(label="HTML"),
95
  gr.File(label="File"),
96
  gr.Dataframe(label="Dataframe"),
97
  gr.Dataframe(label="Numpy"),
 
101
  [
102
  "the quick brown fox",
103
  "jumps over the lazy dog",
104
+ #10,
105
+ #12,
106
+ #4,
107
+ #True,
108
+ #["foo", "baz"],
109
+ #"baz",
110
+ #"bar",
111
+ #os.path.join(os.path.dirname(__file__), "files/cheetah1.jpg"),
112
+ #os.path.join(os.path.dirname(__file__), "files/cheetah1.jpg"),
113
+ #os.path.join(os.path.dirname(__file__), "files/cheetah1.jpg"),
114
  os.path.join(os.path.dirname(__file__), "files/cheetah1.jpg"),
115
+ #os.path.join(os.path.dirname(__file__), "files/world.mp4"),
116
+ #os.path.join(os.path.dirname(__file__), "files/cantina.wav"),
117
+ #os.path.join(os.path.dirname(__file__), "files/cantina.wav"),
 
 
 
118
  os.path.join(os.path.dirname(__file__), "files/titanic.csv"),
119
  [[1, 2, 3], [3, 4, 5]],
120
  os.path.join(os.path.dirname(__file__), "files/time.csv"),