Spaces:
Runtime error
Runtime error
revert changes
Browse files
app.py
CHANGED
@@ -19,7 +19,6 @@ client = Client(
|
|
19 |
headers={"Authorization": f"Bearer {API_TOKEN}"},
|
20 |
)
|
21 |
|
22 |
-
repo = None
|
23 |
if HF_TOKEN:
|
24 |
try:
|
25 |
shutil.rmtree("./data/")
|
@@ -29,15 +28,14 @@ if HF_TOKEN:
|
|
29 |
repo = Repository(
|
30 |
local_dir="./data/", clone_from="HuggingFaceH4/starchat-prompts", use_auth_token=HF_TOKEN, repo_type="dataset"
|
31 |
)
|
|
|
32 |
|
33 |
|
34 |
def save_inputs_and_outputs(inputs, outputs, generate_kwargs):
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
f.write("\n")
|
40 |
-
repo.push_to_hub()
|
41 |
|
42 |
|
43 |
def get_total_inputs(inputs, chatbot, preprompt, user_name, assistant_name, sep):
|
|
|
19 |
headers={"Authorization": f"Bearer {API_TOKEN}"},
|
20 |
)
|
21 |
|
|
|
22 |
if HF_TOKEN:
|
23 |
try:
|
24 |
shutil.rmtree("./data/")
|
|
|
28 |
repo = Repository(
|
29 |
local_dir="./data/", clone_from="HuggingFaceH4/starchat-prompts", use_auth_token=HF_TOKEN, repo_type="dataset"
|
30 |
)
|
31 |
+
repo.git_pull()
|
32 |
|
33 |
|
34 |
def save_inputs_and_outputs(inputs, outputs, generate_kwargs):
|
35 |
+
with open(os.path.join("data", "prompts.jsonl"), "a") as f:
|
36 |
+
json.dump({"inputs": inputs, "outputs": outputs, "generate_kwargs": generate_kwargs}, f, ensure_ascii=False)
|
37 |
+
f.write("\n")
|
38 |
+
repo.push_to_hub()
|
|
|
|
|
39 |
|
40 |
|
41 |
def get_total_inputs(inputs, chatbot, preprompt, user_name, assistant_name, sep):
|