Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -18,42 +18,14 @@ 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(
|
22 |
-
|
23 |
-
text2,
|
24 |
-
num,
|
25 |
-
slider1,
|
26 |
-
slider2,
|
27 |
-
single_checkbox,
|
28 |
-
checkboxes,
|
29 |
-
radio,
|
30 |
-
dropdown,
|
31 |
-
im1,
|
32 |
-
im2,
|
33 |
-
im3,
|
34 |
-
im4,
|
35 |
-
video,
|
36 |
-
audio1,
|
37 |
-
audio2,
|
38 |
-
file,
|
39 |
-
df1,
|
40 |
-
df2,
|
41 |
-
):
|
42 |
return (
|
43 |
-
(text1 if single_checkbox else text2)
|
44 |
-
+ ",
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
"negative": slider1 / (num + slider1 + slider2),
|
49 |
-
"neutral": slider2 / (num + slider1 + slider2),
|
50 |
-
}, # Label
|
51 |
-
(audio1[0], np.flipud(audio1[1]))
|
52 |
-
if audio1 is not None else os.path.join(os.path.dirname(__file__), "files/cantina.wav"), # Audio
|
53 |
-
np.flipud(im1)
|
54 |
-
if im1 is not None else os.path.join(os.path.dirname(__file__), "files/cheetah1.jpg"), # Image
|
55 |
-
video
|
56 |
-
if video is not None else os.path.join(os.path.dirname(__file__), "files/world.mp4"), # Video
|
57 |
[
|
58 |
("The", "art"),
|
59 |
("quick brown", "adj"),
|
@@ -155,33 +127,4 @@ demo = gr.Interface(
|
|
155 |
)
|
156 |
|
157 |
if __name__ == "__main__":
|
158 |
-
demo.launch()
|
159 |
-
|
160 |
-
|
161 |
-
#-or-
|
162 |
-
#git lfs install
|
163 |
-
#git clone https://huggingface.co/datasets/awacke1/SNOMED-CT-Code-Value-Semantic-Set.csv
|
164 |
-
# if you want to clone without large files – just their pointers
|
165 |
-
# prepend your git clone with the following env var:
|
166 |
-
#GIT_LFS_SKIP_SMUDGE=1
|
167 |
-
|
168 |
-
#---
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
#-or-
|
173 |
-
#git lfs install
|
174 |
-
#git clone https://huggingface.co/datasets/awacke1/eCQM-Code-Value-Semantic-Set.csv
|
175 |
-
# if you want to clone without large files – just their pointers
|
176 |
-
# prepend your git clone with the following env var:
|
177 |
-
#GIT_LFS_SKIP_SMUDGE=1
|
178 |
-
|
179 |
-
#---
|
180 |
-
|
181 |
-
#-or-
|
182 |
-
|
183 |
-
#git lfs install
|
184 |
-
#git clone https://huggingface.co/datasets/awacke1/LOINC-CodeSet-Value-Description.csv
|
185 |
-
# if you want to clone without large files – just their pointers
|
186 |
-
# prepend your git clone with the following env var:
|
187 |
-
#GIT_LFS_SKIP_SMUDGE=1
|
|
|
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
|
26 |
+
(audio1[0], np.flipud(audio1[1])) if audio1 is not None else os.path.join(os.path.dirname(__file__), "files/cantina.wav"), # Audio
|
27 |
+
np.flipud(im1) if im1 is not None else os.path.join(os.path.dirname(__file__), "files/cheetah1.jpg"), # Image
|
28 |
+
video if video is not None else os.path.join(os.path.dirname(__file__), "files/world.mp4"), # Video
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
[
|
30 |
("The", "art"),
|
31 |
("quick brown", "adj"),
|
|
|
127 |
)
|
128 |
|
129 |
if __name__ == "__main__":
|
130 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|