Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -80,6 +80,8 @@ 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 |
|
85 |
repo = Repository(
|
@@ -91,15 +93,6 @@ repo = Repository(
|
|
91 |
|
92 |
# print("hfh", huggingface_hub.__version__)
|
93 |
|
94 |
-
# from huggingface_hub import Repository
|
95 |
-
# from git import repo
|
96 |
-
|
97 |
-
# api = HfApi()
|
98 |
-
#device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
99 |
-
|
100 |
-
# from git import Repo
|
101 |
-
|
102 |
-
# Repo.clone_from('https://github.com/gseetha04/IMA-weights.git', branch='master')
|
103 |
|
104 |
def main():
|
105 |
|
@@ -118,20 +111,6 @@ def main():
|
|
118 |
uploaded_file = PdfReader('sample_anno.pdf')
|
119 |
st.error("Please upload your own PDF to be analyzed")
|
120 |
|
121 |
-
|
122 |
-
# try:
|
123 |
-
# #if uploaded_file is not None:
|
124 |
-
# uploaded_file = st.sidebar.file_uploader("Choose a file", type = "pdf")
|
125 |
-
# #st.stop()
|
126 |
-
# except:
|
127 |
-
# #uploaded_file = PdfReader('sample_anno.pdf')
|
128 |
-
# st.error("Please upload your own PDF to be analyzed")
|
129 |
-
|
130 |
-
#except:
|
131 |
-
#if uploaded_file
|
132 |
-
#st.write("Upload a pdf file...")
|
133 |
-
#st.stop()
|
134 |
-
|
135 |
if uploaded_file is not None:
|
136 |
reader = PdfReader(uploaded_file)
|
137 |
for page in reader.pages:
|
@@ -534,8 +513,8 @@ def main():
|
|
534 |
with open(DATA_FILE, 'a') as f: #w+
|
535 |
json.dump(json_data, f)
|
536 |
#repo.push_to_hub()
|
537 |
-
commit_url = repo.push_to_hub()
|
538 |
-
st.write(commit_url)
|
539 |
#dataset = load_dataset("seetha/visual_files")
|
540 |
#repo.push_to_hub("level2.json")
|
541 |
# # repo.git_pull()
|
|
|
80 |
DATA_FILENAME = "level2.json"
|
81 |
DATA_FILE = os.path.join("level2", DATA_FILENAME)
|
82 |
|
83 |
+
st.write(DATA_FILE)
|
84 |
+
|
85 |
HF_TOKEN = os.environ.get("HF_TOKEN")
|
86 |
|
87 |
repo = Repository(
|
|
|
93 |
|
94 |
# print("hfh", huggingface_hub.__version__)
|
95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
def main():
|
98 |
|
|
|
111 |
uploaded_file = PdfReader('sample_anno.pdf')
|
112 |
st.error("Please upload your own PDF to be analyzed")
|
113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
if uploaded_file is not None:
|
115 |
reader = PdfReader(uploaded_file)
|
116 |
for page in reader.pages:
|
|
|
513 |
with open(DATA_FILE, 'a') as f: #w+
|
514 |
json.dump(json_data, f)
|
515 |
#repo.push_to_hub()
|
516 |
+
# commit_url = repo.push_to_hub()
|
517 |
+
# st.write(commit_url)
|
518 |
#dataset = load_dataset("seetha/visual_files")
|
519 |
#repo.push_to_hub("level2.json")
|
520 |
# # repo.git_pull()
|