Spaces:
Runtime error
Runtime error
feat: use git push; fix: use environment variables
Browse files6 unmodified lines789101011121314151617181910 unmodified lines3031323334353637383940414243444546474849506 unmodified linesfrom huggingface_hub import Repository, InferenceClient
HF_TOKEN = os.environ.get("HF_TOKEN", None)API_URL = "https://api-inference.huggingface.co/models/DataAnalyticsLab/PersianGPT-FT-Grover"API_URL = os.environ.get("API_URL", None)DATASET_REPO_URL = os.getenv("DATASET_REPO_URL")FORCE_PUSH = os.getenv("FORCE_PUSH")BOT_NAME = "PersianGPT-FT"PUSH_FREQUENCY = 60 # every minute
repo = Repository(local_dir="data", clone_from=DATASET_REPO_URL, use_auth_token=HF_TOKEN)
stop_sequences = [] #["<|endoftext|>",">"]
10 unmodified lines headers={"Authorization": f"Bearer {HF_TOKEN}"},)
def asynchronous_push(f_stop): if repo.is_repo_clean(): print("Repo currently clean. Ignoring push_to_hub") print(repo.huggingface_token) else: repo.git_add(auto_lfs_track=True) repo.git_commit("Auto commit by space") if FORCE_PUSH == "yes": force_git_push(repo) else: repo.git_push() if not f_stop.is_set(): # call again in 60 seconds threading.Timer(PUSH_FREQUENCY, asynchronous_push, [f_stop]).start()
def vote(data: gr.LikeData): if data.liked: print("You upvoted this response: " + data.value)app.py+21-1