Seetha commited on
Commit
2ac9c7b
1 Parent(s): 33d1718

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -8
app.py CHANGED
@@ -69,7 +69,7 @@ from datasets import load_dataset
69
  dataset = load_dataset('Seetha/Visualization', streaming=True)
70
  df = pd.DataFrame.from_dict(dataset['train'])
71
 
72
- st.write(df)
73
  def main():
74
 
75
  st.title("Text to Causal Knowledge Graph")
@@ -463,7 +463,7 @@ def main():
463
  writer.close()
464
  #df = pd.read_csv('final_data.csv', index_col=0)
465
  #474-515
466
- # # Convert to JSON format
467
  json_data = []
468
  for row in df_tab.index:
469
  for col in df_tab.columns:
@@ -473,12 +473,16 @@ def main():
473
  'value': int(df_tab.loc[row, col])
474
  })
475
  dat = json.dumps(json_data)
476
- with open('level2.json','r+') as fi:
477
- data = fi.read()
478
- #st.write(data)
479
- fi.seek(0)
480
- fi.write(dat)
481
- fi.truncate()
 
 
 
 
482
 
483
  df_final1.to_csv('predictions.csv')
484
  csv_file = "predictions.csv"
 
69
  dataset = load_dataset('Seetha/Visualization', streaming=True)
70
  df = pd.DataFrame.from_dict(dataset['train'])
71
 
72
+
73
  def main():
74
 
75
  st.title("Text to Causal Knowledge Graph")
 
463
  writer.close()
464
  #df = pd.read_csv('final_data.csv', index_col=0)
465
  #474-515
466
+ # Convert to JSON format
467
  json_data = []
468
  for row in df_tab.index:
469
  for col in df_tab.columns:
 
473
  'value': int(df_tab.loc[row, col])
474
  })
475
  dat = json.dumps(json_data)
476
+ level2_df = pd.DataFrame(dat)
477
+ st.write(level2_df)
478
+ # with open('level2.json','r+') as fi:
479
+ # data = fi.read()
480
+ # #st.write(data)
481
+ # fi.seek(0)
482
+ # fi.write(dat)
483
+ # fi.truncate()
484
+
485
+ updated_dataset = dataset.map(lambda example: {'new_value': level2_df['value'], 'new_source':level2_df['source'], 'new_target': level2_df['target']},remove_columns=['value','source','target'])
486
 
487
  df_final1.to_csv('predictions.csv')
488
  csv_file = "predictions.csv"