awacke1 commited on
Commit
9cae1de
ยท
1 Parent(s): dcf274c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -10
app.py CHANGED
@@ -1,22 +1,21 @@
1
  import os
2
  import csv
3
  import gradio as gr
4
- from gradio import inputs
5
-
6
-
7
  import huggingface_hub
8
- print("hfh", huggingface_hub.__version__)
9
- from huggingface_hub import hf_hub_download, upload_file
10
  from datetime import datetime
11
 
12
- DATASET_REPO_ID = "datasets/awacke1/data.csv"
13
- DATASET_REPO_URL = f"https://huggingface.co/{DATASET_REPO_ID}"
14
- DATA_DIRNAME = "data"
15
  DATA_FILENAME = "data.csv"
16
- DATA_FILE = os.path.join(DATA_DIRNAME, DATA_FILENAME)
 
 
17
 
18
  HF_TOKEN = os.environ.get("HF_TOKEN")
19
-
20
 
21
  print("hfh", huggingface_hub.__version__)
22
 
@@ -45,6 +44,10 @@ except:
45
  # file not found, we'll create it on the fly.
46
  print("file not found, probably")
47
 
 
 
 
 
48
 
49
  def generate_html() -> str:
50
  with open(DATA_FILE) as csvfile:
 
1
  import os
2
  import csv
3
  import gradio as gr
4
+ from gradio import inputs, outputs
 
 
5
  import huggingface_hub
6
+ from huggingface_hub import Repository, hf_hub_download, upload_file
 
7
  from datetime import datetime
8
 
9
+ print("hfh", huggingface_hub.__version__)
10
+
11
+ DATASET_REPO_URL = "https://huggingface.co/datasets/awacke1/data.csv"
12
  DATA_FILENAME = "data.csv"
13
+ #DATA_FILE = os.path.join(DATA_DIRNAME, DATA_FILENAME)
14
+ #DATA_DIRNAME = "data"
15
+ DATA_FILE = os.path.join("data", DATA_FILENAME)
16
 
17
  HF_TOKEN = os.environ.get("HF_TOKEN")
18
+ print("is none?", HF_TOKEN is None)
19
 
20
  print("hfh", huggingface_hub.__version__)
21
 
 
44
  # file not found, we'll create it on the fly.
45
  print("file not found, probably")
46
 
47
+ repo = Repository(
48
+ local_dir="data", clone_from=DATASET_REPO_URL, use_auth_token=HF_TOKEN
49
+ )
50
+
51
 
52
  def generate_html() -> str:
53
  with open(DATA_FILE) as csvfile: