import gradio as gr import pypokedex import json import utils import datetime from huggingface_hub import login, HfApi import os streaks = utils.get_streak() pokemons = utils.get_pokemon() hf_token = os.environ["HF_TOKEN"] login(hf_token) hfapi = HfApi() def new_streak(intensity): global pokemons pokemons = utils.get_pokemon() reward = utils.new_streak(intensity) new_streak = utils.get_streak() return f"{new_streak} streak days", '## ' + '✅ ' * new_streak, reward # def update_pokemon_gallery(): # pokemon_exps = [] # pokemons = utils.get_pokemon() # for dex in pokemons.keys(): # info = gr.Markdown(f"**EXP**: {utils.get_poke_energy(dex)}") # pokemon_exps.append(info) # return pokemon_exps def restart(): with open('dummy.txt', 'w') as f: f.write(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")) hfapi.upload_file( path_or_fileobj="dummy.txt", path_in_repo="dummy.txt", repo_id="panda1835/pokemon-habit", repo_type="space", ) with gr.Blocks() as demo: gr.Markdown('