Seetha commited on
Commit
09775f8
1 Parent(s): cb70409

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -21
app.py CHANGED
@@ -66,18 +66,18 @@ import gradio as gr
66
  from gradio import inputs, outputs
67
 
68
 
69
- DATASET_REPO_URL = "https://huggingface.co/datasets/Seetha/visual_files"
70
- DATA_FILENAME = "level2.json"
71
- DATA_FILE = os.path.join("raw/main", 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="huggingface-hub", clone_from=DATASET_REPO_URL, use_auth_token=HF_TOKEN
80
- )
81
 
82
 
83
  def main():
@@ -482,10 +482,13 @@ def main():
482
  'value': int(df_tab.loc[row, col])
483
  })
484
 
 
 
 
485
  # Write JSON to file
486
  #with open(DATA_FILE, 'w') as f: #w+
487
- # with urllib.request.urlopen(DATASET_REPO_URL) as response:
488
- # data = response.read()
489
 
490
  # with open('level2.json','w') as f:
491
  # st.write(f.read())
@@ -499,18 +502,18 @@ def main():
499
  st.write(str(json_data))
500
  json.dump(json_data, f)
501
 
502
- def store_message():
503
- with open(DATA_FILE, "w") as f:
504
- json.dump(json_data, f)
505
- commit_url = repo.push_to_hub()
506
- st.write(commit_url)
507
 
508
- #return generate_html()
509
- iface = gr.Interface(
510
- store_message()
511
- )
512
 
513
- iface.launch()
514
 
515
  #f.truncate()
516
 
 
66
  from gradio import inputs, outputs
67
 
68
 
69
+ # DATASET_REPO_URL = "https://huggingface.co/datasets/Seetha/visual_files"
70
+ # DATA_FILENAME = "level2.json"
71
+ # DATA_FILE = os.path.join("raw/main", 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="huggingface-hub", clone_from=DATASET_REPO_URL, use_auth_token=HF_TOKEN
80
+ # )
81
 
82
 
83
  def main():
 
482
  'value': int(df_tab.loc[row, col])
483
  })
484
 
485
+
486
+ dataset = load_dataset("Seetha/visual_files")
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
+ data = response.read()
492
 
493
  # with open('level2.json','w') as f:
494
  # st.write(f.read())
 
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:
507
+ # json.dump(json_data, f)
508
+ # commit_url = repo.push_to_hub()
509
+ # st.write(commit_url)
510
 
511
+ # #return generate_html()
512
+ # iface = gr.Interface(
513
+ # store_message()
514
+ # )
515
 
516
+ # iface.launch()
517
 
518
  #f.truncate()
519