Spaces:
Runtime error
Runtime error
rotaba
commited on
Commit
·
0d986e2
1
Parent(s):
c7838e5
now data proper and upacking should work
Browse files- app.py +16 -22
- assets/data_sorted.csv +0 -0
app.py
CHANGED
@@ -18,27 +18,21 @@ os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
|
18 |
warnings.filterwarnings('ignore')
|
19 |
# from flair_recognizer import FlairRecognizer
|
20 |
|
21 |
-
# helper method to open csv and read columns
|
22 |
def load_data(file_location):
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
dataA.append(a)
|
38 |
-
dataB.append(b)
|
39 |
-
dataC.append(c)
|
40 |
-
|
41 |
-
return dataA, dataB, dataC
|
42 |
|
43 |
# Helper methods
|
44 |
@st.cache(allow_output_mutation=True)
|
@@ -155,7 +149,7 @@ st.sidebar.info(
|
|
155 |
|
156 |
# Main panel
|
157 |
analyzer_load_state = st.info(
|
158 |
-
"Starting
|
159 |
engine = analyzer_engine()
|
160 |
analyzer_load_state.empty()
|
161 |
|
@@ -183,7 +177,7 @@ with col1:
|
|
183 |
|
184 |
with col2:
|
185 |
st.checkbox("Enable/Disable selectbox widget", key="disabled")
|
186 |
-
titles, urls, jsons = load_data("assets/
|
187 |
option_list = titles
|
188 |
option = st.selectbox(
|
189 |
"How would you like to be contacted?",
|
|
|
18 |
warnings.filterwarnings('ignore')
|
19 |
# from flair_recognizer import FlairRecognizer
|
20 |
|
|
|
21 |
def load_data(file_location):
|
22 |
+
unpacked_string_data = []
|
23 |
+
unpacked_url_data = []
|
24 |
+
unpacked_json_data = []
|
25 |
+
# Read the data back from the CSV file and unpack it
|
26 |
+
with open(file_location, mode='r') as csv_file:
|
27 |
+
reader = csv.reader(csv_file)
|
28 |
+
for row in reader:
|
29 |
+
unpacked_string_data.append(row[0])
|
30 |
+
unpacked_url_data.append(row[1])
|
31 |
+
unpacked_json_data.append(json.loads(row[2]))
|
32 |
+
# print("Unpacked string data:", unpacked_string_data)
|
33 |
+
# print("Unpacked url data:", unpacked_url_data)
|
34 |
+
# print("Unpacked JSON data:", unpacked_json_data)
|
35 |
+
return unpacked_string_data, unpacked_url_data, unpacked_json_data
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
# Helper methods
|
38 |
@st.cache(allow_output_mutation=True)
|
|
|
149 |
|
150 |
# Main panel
|
151 |
analyzer_load_state = st.info(
|
152 |
+
"Starting analyzer and loading model...")
|
153 |
engine = analyzer_engine()
|
154 |
analyzer_load_state.empty()
|
155 |
|
|
|
177 |
|
178 |
with col2:
|
179 |
st.checkbox("Enable/Disable selectbox widget", key="disabled")
|
180 |
+
titles, urls, jsons = load_data("assets/data_sorted.csv")
|
181 |
option_list = titles
|
182 |
option = st.selectbox(
|
183 |
"How would you like to be contacted?",
|
assets/data_sorted.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|