Spaces:
Runtime error
Runtime error
Commit
Β·
6a4226d
1
Parent(s):
32a3bbb
Debug
Browse files
app.py
CHANGED
|
@@ -23,20 +23,6 @@ DATASET_REPO_URL = "https://huggingface.co/datasets/liujch1998/cd-pi-dataset"
|
|
| 23 |
DATA_DIR = 'data'
|
| 24 |
DATA_PATH = os.path.join(DATA_DIR, 'data.jsonl')
|
| 25 |
|
| 26 |
-
try:
|
| 27 |
-
shutil.rmtree(DATA_DIR)
|
| 28 |
-
except:
|
| 29 |
-
pass
|
| 30 |
-
repo = huggingface_hub.Repository(
|
| 31 |
-
local_dir=DATA_DIR,
|
| 32 |
-
clone_from=DATASET_REPO_URL,
|
| 33 |
-
token=HF_TOKEN_UPLOAD,
|
| 34 |
-
repo_type='dataset',
|
| 35 |
-
)
|
| 36 |
-
repo.git_pull()
|
| 37 |
-
|
| 38 |
-
lock = threading.Lock()
|
| 39 |
-
|
| 40 |
class Interactive:
|
| 41 |
def __init__(self):
|
| 42 |
self.tokenizer = transformers.AutoTokenizer.from_pretrained(MODEL_NAME, use_auth_token=HF_TOKEN_DOWNLOAD)
|
|
@@ -112,6 +98,19 @@ class Interactive:
|
|
| 112 |
|
| 113 |
interactive = Interactive()
|
| 114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
# def predict(statement, do_save=True):
|
| 116 |
# output_raw = interactive.run(statement)
|
| 117 |
# output = {
|
|
@@ -199,7 +198,14 @@ def push():
|
|
| 199 |
commit_url = repo.push_to_hub()
|
| 200 |
except Exception as e:
|
| 201 |
print('Failed to push to git:', e)
|
| 202 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
lock.release()
|
| 204 |
|
| 205 |
examples = [
|
|
|
|
| 23 |
DATA_DIR = 'data'
|
| 24 |
DATA_PATH = os.path.join(DATA_DIR, 'data.jsonl')
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
class Interactive:
|
| 27 |
def __init__(self):
|
| 28 |
self.tokenizer = transformers.AutoTokenizer.from_pretrained(MODEL_NAME, use_auth_token=HF_TOKEN_DOWNLOAD)
|
|
|
|
| 98 |
|
| 99 |
interactive = Interactive()
|
| 100 |
|
| 101 |
+
try:
|
| 102 |
+
shutil.rmtree(DATA_DIR)
|
| 103 |
+
except:
|
| 104 |
+
pass
|
| 105 |
+
repo = huggingface_hub.Repository(
|
| 106 |
+
local_dir=DATA_DIR,
|
| 107 |
+
clone_from=DATASET_REPO_URL,
|
| 108 |
+
token=HF_TOKEN_UPLOAD,
|
| 109 |
+
repo_type='dataset',
|
| 110 |
+
)
|
| 111 |
+
repo.git_pull()
|
| 112 |
+
lock = threading.Lock()
|
| 113 |
+
|
| 114 |
# def predict(statement, do_save=True):
|
| 115 |
# output_raw = interactive.run(statement)
|
| 116 |
# output = {
|
|
|
|
| 198 |
commit_url = repo.push_to_hub()
|
| 199 |
except Exception as e:
|
| 200 |
print('Failed to push to git:', e)
|
| 201 |
+
shutil.rmtree(DATA_DIR)
|
| 202 |
+
repo = huggingface_hub.Repository(
|
| 203 |
+
local_dir=DATA_DIR,
|
| 204 |
+
clone_from=DATASET_REPO_URL,
|
| 205 |
+
token=HF_TOKEN_UPLOAD,
|
| 206 |
+
repo_type='dataset',
|
| 207 |
+
)
|
| 208 |
+
repo.git_pull()
|
| 209 |
lock.release()
|
| 210 |
|
| 211 |
examples = [
|