Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -71,7 +71,19 @@ from PyPDF2 import PdfReader
|
|
71 |
from huggingface_hub import HfApi
|
72 |
import io
|
73 |
from datasets import load_dataset
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
# from huggingface_hub import Repository
|
77 |
# from git import repo
|
@@ -496,7 +508,7 @@ def main():
|
|
496 |
df_tab.to_excel(writer,sheet_name="count_result",index=False)
|
497 |
df_final1.to_excel(writer,sheet_name="Detailed_results",index=False)
|
498 |
writer.close()
|
499 |
-
df = pd.read_csv('final_data.csv', index_col=0)
|
500 |
#474-515
|
501 |
# # Convert to JSON format
|
502 |
json_data = []
|
@@ -509,8 +521,11 @@ def main():
|
|
509 |
})
|
510 |
|
511 |
# Write JSON to file
|
512 |
-
with open('
|
513 |
json.dump(json_data, f)
|
|
|
|
|
|
|
514 |
# # repo.git_pull()
|
515 |
# # repo.git_add("ch.json")
|
516 |
# # repo.git_commit(commit_message="add ch.json :)")
|
@@ -524,19 +539,19 @@ def main():
|
|
524 |
# csv_data = csv.DictReader(f)
|
525 |
|
526 |
# # Convert the CSV data to a list of dictionaries
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
|
531 |
# # Convert the list of dictionaries to JSON
|
532 |
-
|
533 |
|
534 |
# # Write the JSON data to a file
|
535 |
# #with open("smalljson.json", "r+") as fi:
|
536 |
# #data = fi.read()
|
537 |
# #fi.seek(0)
|
538 |
-
|
539 |
-
|
540 |
# #st.write(data)
|
541 |
# # fi.seek(0)
|
542 |
# fi.write(json_data)
|
|
|
71 |
from huggingface_hub import HfApi
|
72 |
import io
|
73 |
from datasets import load_dataset
|
74 |
+
|
75 |
+
import huggingface_hub
|
76 |
+
from huggingface_hub import Repository
|
77 |
+
from datetime import datetime
|
78 |
+
|
79 |
+
DATASET_REPO_URL = "https://huggingface.co/datasets/Seetha/visual_files"
|
80 |
+
DATA_FILENAME = "level2.json"
|
81 |
+
DATA_FILE = os.path.join("level2", DATA_FILENAME)
|
82 |
+
|
83 |
+
HF_TOKEN = os.environ.get("HF_TOKEN")
|
84 |
+
# print("is none?", HF_TOKEN is None)
|
85 |
+
|
86 |
+
# print("hfh", huggingface_hub.__version__)
|
87 |
|
88 |
# from huggingface_hub import Repository
|
89 |
# from git import repo
|
|
|
508 |
df_tab.to_excel(writer,sheet_name="count_result",index=False)
|
509 |
df_final1.to_excel(writer,sheet_name="Detailed_results",index=False)
|
510 |
writer.close()
|
511 |
+
#df = pd.read_csv('final_data.csv', index_col=0)
|
512 |
#474-515
|
513 |
# # Convert to JSON format
|
514 |
json_data = []
|
|
|
521 |
})
|
522 |
|
523 |
# Write JSON to file
|
524 |
+
with open('level2.json', 'w+') as f:
|
525 |
json.dump(json_data, f)
|
526 |
+
|
527 |
+
dataset = load_dataset("seetha/visual_files")
|
528 |
+
dataset.push_to_hub("seetha/visual_files/level2.json")
|
529 |
# # repo.git_pull()
|
530 |
# # repo.git_add("ch.json")
|
531 |
# # repo.git_commit(commit_message="add ch.json :)")
|
|
|
539 |
# csv_data = csv.DictReader(f)
|
540 |
|
541 |
# # Convert the CSV data to a list of dictionaries
|
542 |
+
data_list = []
|
543 |
+
for row in df_final1.iterrows():
|
544 |
+
data_list.append(dict(row))
|
545 |
|
546 |
# # Convert the list of dictionaries to JSON
|
547 |
+
json_data = json.dumps(data_list)
|
548 |
|
549 |
# # Write the JSON data to a file
|
550 |
# #with open("smalljson.json", "r+") as fi:
|
551 |
# #data = fi.read()
|
552 |
# #fi.seek(0)
|
553 |
+
with open('smalljson.json','w+') as fi:
|
554 |
+
data = json.load(fi)
|
555 |
# #st.write(data)
|
556 |
# # fi.seek(0)
|
557 |
# fi.write(json_data)
|