georad commited on
Commit
5808786
Β·
verified Β·
1 Parent(s): efa48a2

Update pages/upload_file.py

Browse files
Files changed (1) hide show
  1. pages/upload_file.py +37 -38
pages/upload_file.py CHANGED
@@ -18,8 +18,7 @@ def convert_json(df:pd.DataFrame):
18
  json_string = json.dumps(parsed)
19
  #st.json(json_string, expanded=True)
20
  return json_string
21
-
22
- #st.title("πŸ“˜SBS mapper")
23
  st.header("Work in Progress")
24
 
25
  uploaded_file = st.file_uploader(label = "Upload single csv file")
@@ -35,45 +34,45 @@ if uploaded_file is not None:
35
 
36
  createNER_button = st.button("Map to SBS codes")
37
 
38
- col1, col2, col3 = st.columns([1,1,2.5])
39
- col1.subheader("Score")
40
- col2.subheader("SBS code")
41
- col3.subheader("SBS description V2.0")
42
 
43
  dictA = {"Score": [], "SBS Code": [], "SBS Description V2.0": []}
44
 
45
 
46
- if uploaded_file is not None and createNER_button == True:
47
- dict1 = {"word": [], "entity": []}
48
- dict2 = {"word": [], "entity": []}
49
- #stringio = StringIO(uploaded_file.getvalue().decode("utf-8"))
50
- #string_data = stringio.read()
51
- #st.write("Your input is: ", string_data)
52
- #with col1:
53
- # #st.write(my_model_results(string_data))
54
- # #col1.subheader("myDemo Model")
55
- # #for result in my_model_results(string_data):
56
- # # st.write(result['word'], result['entity'])
57
- # # dict1["word"].append(result['word']), dict1["entity"].append(result['entity'])
58
- # #df1 = pd.DataFrame.from_dict(dict1)
59
- # #st.write(df1)
60
- with col2:
61
- #st.write(HuggingFace_model_results(string_data))
62
- #col2.subheader("Hugging Face Model")
63
- for result in HuggingFace_model_results(string_data):
64
- st.write(result['word'], result['entity'])
65
- dict2["word"].append(result['word']), dict2["entity"].append(result['entity'])
66
- df2 = pd.DataFrame.from_dict(dict2)
67
- #st.write(df2)
68
 
69
 
70
- cs, c1, c2, c3, cLast = st.columns([0.75, 1.5, 1.5, 1.5, 0.75])
71
- with c1:
72
- #csvbutton = download_button(results, "results.csv", "πŸ“₯ Download .csv")
73
- csvbutton = st.download_button(label="πŸ“₯ Download .csv", data=convert_df(df1), file_name= "results.csv", mime='text/csv', key='csv')
74
- with c2:
75
- #textbutton = download_button(results, "results.txt", "πŸ“₯ Download .txt")
76
- textbutton = st.download_button(label="πŸ“₯ Download .txt", data=convert_df(df1), file_name= "results.text", mime='text/plain', key='text')
77
- with c3:
78
- #jsonbutton = download_button(results, "results.json", "πŸ“₯ Download .json")
79
- jsonbutton = st.download_button(label="πŸ“₯ Download .json", data=convert_json(df1), file_name= "results.json", mime='application/json', key='json')
 
18
  json_string = json.dumps(parsed)
19
  #st.json(json_string, expanded=True)
20
  return json_string
21
+
 
22
  st.header("Work in Progress")
23
 
24
  uploaded_file = st.file_uploader(label = "Upload single csv file")
 
34
 
35
  createNER_button = st.button("Map to SBS codes")
36
 
37
+ #col1, col2, col3 = st.columns([1,1,2.5])
38
+ #col1.subheader("Score")
39
+ #col2.subheader("SBS code")
40
+ #col3.subheader("SBS description V2.0")
41
 
42
  dictA = {"Score": [], "SBS Code": [], "SBS Description V2.0": []}
43
 
44
 
45
+ #if uploaded_file is not None and createNER_button == True:
46
+ # dict1 = {"word": [], "entity": []}
47
+ # dict2 = {"word": [], "entity": []}
48
+ # #stringio = StringIO(uploaded_file.getvalue().decode("utf-8"))
49
+ # #string_data = stringio.read()
50
+ # #st.write("Your input is: ", string_data)
51
+ # #with col1:
52
+ # # #st.write(my_model_results(string_data))
53
+ # # #col1.subheader("myDemo Model")
54
+ # # #for result in my_model_results(string_data):
55
+ # # # st.write(result['word'], result['entity'])
56
+ # # # dict1["word"].append(result['word']), dict1["entity"].append(result['entity'])
57
+ # # #df1 = pd.DataFrame.from_dict(dict1)
58
+ # # #st.write(df1)
59
+ # with col2:
60
+ # #st.write(HuggingFace_model_results(string_data))
61
+ # #col2.subheader("Hugging Face Model")
62
+ # for result in HuggingFace_model_results(string_data):
63
+ # st.write(result['word'], result['entity'])
64
+ # dict2["word"].append(result['word']), dict2["entity"].append(result['entity'])
65
+ # df2 = pd.DataFrame.from_dict(dict2)
66
+ # #st.write(df2)
67
 
68
 
69
+ # cs, c1, c2, c3, cLast = st.columns([0.75, 1.5, 1.5, 1.5, 0.75])
70
+ # with c1:
71
+ # #csvbutton = download_button(results, "results.csv", "πŸ“₯ Download .csv")
72
+ # csvbutton = st.download_button(label="πŸ“₯ Download .csv", data=convert_df(df1), file_name= "results.csv", mime='text/csv', key='csv')
73
+ # with c2:
74
+ # #textbutton = download_button(results, "results.txt", "πŸ“₯ Download .txt")
75
+ # textbutton = st.download_button(label="πŸ“₯ Download .txt", data=convert_df(df1), file_name= "results.text", mime='text/plain', key='text')
76
+ # with c3:
77
+ # #jsonbutton = download_button(results, "results.json", "πŸ“₯ Download .json")
78
+ # jsonbutton = st.download_button(label="πŸ“₯ Download .json", data=convert_json(df1), file_name= "results.json", mime='application/json', key='json')