Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -66,18 +66,18 @@ import gradio as gr
|
|
| 66 |
from gradio import inputs, outputs
|
| 67 |
|
| 68 |
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
|
| 73 |
-
|
| 74 |
-
|
| 75 |
|
| 76 |
-
|
| 77 |
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
|
| 82 |
|
| 83 |
def main():
|
|
@@ -485,22 +485,25 @@ def main():
|
|
| 485 |
|
| 486 |
dataset = load_dataset("Seetha/Visualization")
|
| 487 |
st.write(dataset)
|
|
|
|
|
|
|
|
|
|
| 488 |
# Write JSON to file
|
| 489 |
#with open(DATA_FILE, 'w') as f: #w+
|
| 490 |
-
with urllib.request.urlopen('https://huggingface.co/datasets/Seetha/visual_files/raw/main/level2.json') as response:
|
| 491 |
-
|
| 492 |
|
| 493 |
-
# with open('level2.json','w') as f:
|
| 494 |
-
# st.write(f.read())
|
| 495 |
-
# #st.write(f.write(json.dump(json_data)))
|
| 496 |
-
# #f.write(json.dump(json_data))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 497 |
# json.dump(json_data, f)
|
| 498 |
-
with open('level2.json', "w+") as f:
|
| 499 |
-
# data = f.read()
|
| 500 |
-
# #st.write(data)
|
| 501 |
-
# f.seek(0)
|
| 502 |
-
st.write(str(json_data))
|
| 503 |
-
json.dump(json_data, f)
|
| 504 |
|
| 505 |
# def store_message():
|
| 506 |
# with open(DATA_FILE, "w") as f:
|
|
|
|
| 66 |
from gradio import inputs, outputs
|
| 67 |
|
| 68 |
|
| 69 |
+
DATASET_REPO_URL = "https://huggingface.co/datasets/Seetha/Visualization"
|
| 70 |
+
DATA_FILENAME = "level2.json"
|
| 71 |
+
DATA_FILE = os.path.join("level2", DATA_FILENAME)
|
| 72 |
|
| 73 |
+
HF_TOKEN = os.environ.get("HF_TOKEN")
|
| 74 |
+
st.write("is none?", HF_TOKEN)
|
| 75 |
|
| 76 |
+
st.write("hfh", huggingface_hub.__version__)
|
| 77 |
|
| 78 |
+
repo = Repository(
|
| 79 |
+
local_dir="level2", clone_from=DATASET_REPO_URL, use_auth_token=HF_TOKEN
|
| 80 |
+
)
|
| 81 |
|
| 82 |
|
| 83 |
def main():
|
|
|
|
| 485 |
|
| 486 |
dataset = load_dataset("Seetha/Visualization")
|
| 487 |
st.write(dataset)
|
| 488 |
+
with open(DATA_FILE,'w') as f:
|
| 489 |
+
json.dump(json_data, f)
|
| 490 |
+
repo.push_to_hub()
|
| 491 |
# Write JSON to file
|
| 492 |
#with open(DATA_FILE, 'w') as f: #w+
|
| 493 |
+
# with urllib.request.urlopen('https://huggingface.co/datasets/Seetha/visual_files/raw/main/level2.json') as response:
|
| 494 |
+
# data = response.read()
|
| 495 |
|
| 496 |
+
# # with open('level2.json','w') as f:
|
| 497 |
+
# # st.write(f.read())
|
| 498 |
+
# # #st.write(f.write(json.dump(json_data)))
|
| 499 |
+
# # #f.write(json.dump(json_data))
|
| 500 |
+
# # json.dump(json_data, f)
|
| 501 |
+
# with open('level2.json', "w+") as f:
|
| 502 |
+
# # data = f.read()
|
| 503 |
+
# # #st.write(data)
|
| 504 |
+
# # f.seek(0)
|
| 505 |
+
# st.write(str(json_data))
|
| 506 |
# json.dump(json_data, f)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 507 |
|
| 508 |
# def store_message():
|
| 509 |
# with open(DATA_FILE, "w") as f:
|