Spaces:
Runtime error
Runtime error
feat: use git push; fix: use environment variables
Browse files6 unmodified lines789101112131410 unmodified lines2526272829306 unmodified linesfrom huggingface_hub import Repository, InferenceClientHF_TOKEN = os.environ.get("HF_TOKEN", None)API_URL = "https://api-inference.huggingface.co/models/DataAnalyticsLab/PersianGPT-FT-Grover"BOT_NAME = "PersianGPT-FT"stop_sequences = [] #["<|endoftext|>",">"]10 unmodified linesheaders={"Authorization": f"Bearer {HF_TOKEN}"},)def vote(data: gr.LikeData):if data.liked:print("You upvoted this response: " + data.value)6 unmodified lines7891011121314151617181910 unmodified lines3031323334353637383940414243444546474849506 unmodified linesfrom huggingface_hub import Repository, InferenceClientHF_TOKEN = os.environ.get("HF_TOKEN", None)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 minuterepo = Repository(local_dir="data", clone_from=DATASET_REPO_URL, use_auth_token=HF_TOKEN)stop_sequences = [] #["<|endoftext|>",">"]10 unmodified linesheaders={"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 secondsthreading.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