twdruhot commited on
Commit
c8cce61
·
1 Parent(s): 3a85c41

Update Home.py

Browse files
Files changed (1) hide show
  1. Home.py +14 -13
Home.py CHANGED
@@ -19,6 +19,7 @@ def application():
19
  from datetime import date
20
  from description_generator import input_manager, model_control
21
  from pathlib import Path
 
22
 
23
  #UI Session Variables
24
  if 'desc_iter' not in st.session_state:
@@ -134,21 +135,20 @@ def application():
134
  st.session_state.title_iter = 0
135
  show_title(0)
136
 
137
- def report():
138
  inputs = '|'.join(str(x) for x in st.session_state.inputs)
139
  data = {'rprtd': date.today(),'inpts': inputs, 'title': st.session_state.output_dict[st.session_state.desc_iter]['titles'][st.session_state.title_iter][0], 'desc':st.session_state.output_dict[st.session_state.desc_iter]['text']}
140
  r_df = pd.DataFrame(data, index=[0])
141
  try:
142
- r_p = pd.read_pickle(Path(__file__).parent / "Persistent_Data/reported_df.PICKLE")
 
143
  w_p = pd.concat([r_df, r_p])
144
  w_p = w_p.drop_duplicates()
145
- print('try')
146
- print(w_p)
147
- w_p.to_pickle(Path(__file__).parent / "Persistent_Data/reported_df.PICKLE")
148
  except:
149
- print('except')
150
- print(r_df)
151
- r_df.to_pickle(Path(__file__).parent / "Persistent_Data/reported_df.PICKLE")
152
 
153
 
154
  ###Variables
@@ -407,6 +407,7 @@ def about_us():
407
  def feedback():
408
  import pandas as pd
409
  from pathlib import Path
 
410
 
411
  st.subheader('Leave comments below')
412
 
@@ -415,12 +416,12 @@ def feedback():
415
  sub = st.form_submit_button('Submit')
416
 
417
  if sub:
418
- feed_ser = pd.read_csv(Path(__file__).parent / "Persistent_Data/Feedback.csv")
 
419
  f_s = pd.Series(f)
420
- feed_ser = feed_ser.append(f_s, ignore_index=True)
421
- feed_ser.to_csv(Path(__file__).parent / "Persistent_Data/Feedback.csv")
422
-
423
-
424
 
425
 
426
  with tab1:
 
19
  from datetime import date
20
  from description_generator import input_manager, model_control
21
  from pathlib import Path
22
+ import datasets
23
 
24
  #UI Session Variables
25
  if 'desc_iter' not in st.session_state:
 
135
  st.session_state.title_iter = 0
136
  show_title(0)
137
 
138
+ def report():
139
  inputs = '|'.join(str(x) for x in st.session_state.inputs)
140
  data = {'rprtd': date.today(),'inpts': inputs, 'title': st.session_state.output_dict[st.session_state.desc_iter]['titles'][st.session_state.title_iter][0], 'desc':st.session_state.output_dict[st.session_state.desc_iter]['text']}
141
  r_df = pd.DataFrame(data, index=[0])
142
  try:
143
+ r_d = datasets.load_dataset('auto-bg/reported.json')
144
+ r_p = r_d.to_pandas()
145
  w_p = pd.concat([r_df, r_p])
146
  w_p = w_p.drop_duplicates()
147
+ r_d = datasets.Dataset.from_pandas(w_p)
148
+ r_d.save_to_disk('auto-bg/reported.json')
 
149
  except:
150
+ r_d = datasets.Dataset.from_pandas(r_df)
151
+ r_d.save_to_disk('auto-bg/reported.json')
 
152
 
153
 
154
  ###Variables
 
407
  def feedback():
408
  import pandas as pd
409
  from pathlib import Path
410
+ import datasets
411
 
412
  st.subheader('Leave comments below')
413
 
 
416
  sub = st.form_submit_button('Submit')
417
 
418
  if sub:
419
+ f_f = datasets.load_dataset('auto-bg/feedback.csv')
420
+ f_csv = f_f.to_csv()
421
  f_s = pd.Series(f)
422
+ f_f = f_f.append(f_s, ignore_index=True)
423
+ f_w = datasets.Dataset.from_csv(f_f)
424
+ f_w.save_to_disk('auto-bg/feedback.csv')
 
425
 
426
 
427
  with tab1: