Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -470,49 +470,49 @@ def main():
|
|
| 470 |
df_final1.to_excel(writer,sheet_name="Detailed_results",index=False)
|
| 471 |
writer.close()
|
| 472 |
df = pd.read_csv('final_data.csv', index_col=0)
|
| 473 |
-
|
| 474 |
-
# Convert to JSON format
|
| 475 |
-
json_data = []
|
| 476 |
-
for row in df.index:
|
| 477 |
-
|
| 478 |
-
|
| 479 |
-
|
| 480 |
-
|
| 481 |
-
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
# Write JSON to file
|
| 485 |
-
with open('ch.json', 'w+') as f:
|
| 486 |
-
|
| 487 |
-
|
| 488 |
-
|
| 489 |
-
|
| 490 |
-
|
| 491 |
|
| 492 |
-
csv_file = "predictions.csv"
|
| 493 |
-
#json_file = "smalljson.json"
|
| 494 |
-
|
| 495 |
-
# Open the CSV file and read the data
|
| 496 |
-
with open(csv_file, "r") as f:
|
| 497 |
-
|
| 498 |
-
|
| 499 |
-
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
|
| 503 |
-
|
| 504 |
-
# Convert the list of dictionaries to JSON
|
| 505 |
-
json_data = json.dumps(data_list)
|
| 506 |
-
|
| 507 |
-
# Write the JSON data to a file
|
| 508 |
-
#with open("smalljson.json", "r+") as fi:
|
| 509 |
-
|
| 510 |
-
|
| 511 |
-
with open('smalljson.json','w+') as fi:
|
| 512 |
-
|
| 513 |
-
|
| 514 |
-
|
| 515 |
-
|
| 516 |
# fi.truncate()
|
| 517 |
# file_jso.truncate(0)
|
| 518 |
# file_jso.write(json_data)
|
|
|
|
| 470 |
df_final1.to_excel(writer,sheet_name="Detailed_results",index=False)
|
| 471 |
writer.close()
|
| 472 |
df = pd.read_csv('final_data.csv', index_col=0)
|
| 473 |
+
#474-515
|
| 474 |
+
# # Convert to JSON format
|
| 475 |
+
# json_data = []
|
| 476 |
+
# for row in df.index:
|
| 477 |
+
# for col in df.columns:
|
| 478 |
+
# json_data.append({
|
| 479 |
+
# 'source': row,
|
| 480 |
+
# 'target': col,
|
| 481 |
+
# 'value': int(df.loc[row, col])
|
| 482 |
+
# })
|
| 483 |
+
|
| 484 |
+
# # Write JSON to file
|
| 485 |
+
# with open('ch.json', 'w+') as f:
|
| 486 |
+
# json.dump(json_data, f)
|
| 487 |
+
# # repo.git_pull()
|
| 488 |
+
# # repo.git_add("ch.json")
|
| 489 |
+
# # repo.git_commit(commit_message="add ch.json :)")
|
| 490 |
+
# # repo.push()
|
| 491 |
|
| 492 |
+
# csv_file = "predictions.csv"
|
| 493 |
+
# #json_file = "smalljson.json"
|
| 494 |
+
|
| 495 |
+
# # Open the CSV file and read the data
|
| 496 |
+
# with open(csv_file, "r") as f:
|
| 497 |
+
# csv_data = csv.DictReader(f)
|
| 498 |
+
|
| 499 |
+
# # Convert the CSV data to a list of dictionaries
|
| 500 |
+
# data_list = []
|
| 501 |
+
# for row in csv_data:
|
| 502 |
+
# data_list.append(dict(row))
|
| 503 |
+
|
| 504 |
+
# # Convert the list of dictionaries to JSON
|
| 505 |
+
# json_data = json.dumps(data_list)
|
| 506 |
+
|
| 507 |
+
# # Write the JSON data to a file
|
| 508 |
+
# #with open("smalljson.json", "r+") as fi:
|
| 509 |
+
# #data = fi.read()
|
| 510 |
+
# #fi.seek(0)
|
| 511 |
+
# with open('smalljson.json','w+') as fi:
|
| 512 |
+
# # data = json.load(fi)
|
| 513 |
+
# #st.write(data)
|
| 514 |
+
# # fi.seek(0)
|
| 515 |
+
# fi.write(json_data)
|
| 516 |
# fi.truncate()
|
| 517 |
# file_jso.truncate(0)
|
| 518 |
# file_jso.write(json_data)
|