Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
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 |
-
#
|
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 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
|
|
|
|
|
|
|
|
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"
|