sgongora27 commited on
Commit
dcce3fd
·
1 Parent(s): 8ae9bb8
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -11,6 +11,10 @@ import configparser
11
  import example_worlds
12
  from models import GeminiModel
13
  from prompts import prompt_narrate_current_scene, prompt_world_update, prompt_describe_objective
 
 
 
 
14
 
15
  PATH_GAMELOGS = 'logs'
16
 
@@ -100,6 +104,16 @@ def game_loop(message, history):
100
  # Dump the whole gamelog to a json file after this turn
101
  with open(os.path.join(PATH_GAMELOGS,log_filename), 'w', encoding='utf-8') as f:
102
  json.dump(game_log_dictionary, f, ensure_ascii=False, indent=4)
 
 
 
 
 
 
 
 
 
 
103
 
104
  return answer.replace("<",r"\<").replace(">", r"\>")
105
 
 
11
  import example_worlds
12
  from models import GeminiModel
13
  from prompts import prompt_narrate_current_scene, prompt_world_update, prompt_describe_objective
14
+ from huggingface_hub import HfApi
15
+ from huggingface_hub import login
16
+
17
+ login("HF_key")
18
 
19
  PATH_GAMELOGS = 'logs'
20
 
 
104
  # Dump the whole gamelog to a json file after this turn
105
  with open(os.path.join(PATH_GAMELOGS,log_filename), 'w', encoding='utf-8') as f:
106
  json.dump(game_log_dictionary, f, ensure_ascii=False, indent=4)
107
+
108
+ if world.check_objective():
109
+
110
+ api = HfApi()
111
+ api.upload_file(
112
+ path_or_fileobj=os.path.join(PATH_GAMELOGS,log_filename),
113
+ path_in_repo=os.path.join(PATH_GAMELOGS,log_filename),
114
+ repo_id="sgongora27/PAYADOR-experiments",
115
+ repo_type="space",
116
+ )
117
 
118
  return answer.replace("<",r"\<").replace(">", r"\>")
119