sgongora27 commited on
Commit
f9bf455
verified
1 Parent(s): 0dc29b0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import gradio as gr
2
  from gradio import ChatMessage
 
3
  import re
4
  import sys
5
  import time
@@ -100,6 +101,13 @@ 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
 
 
1
  import gradio as gr
2
  from gradio import ChatMessage
3
+ from huggingface_hub import HfApi
4
  import re
5
  import sys
6
  import time
 
101
  # Dump the whole gamelog to a json file after this turn
102
  with open(os.path.join(PATH_GAMELOGS,log_filename), 'w', encoding='utf-8') as f:
103
  json.dump(game_log_dictionary, f, ensure_ascii=False, indent=4)
104
+
105
+ if world.check_objective():
106
+ api = HfApi()
107
+ api.upload_file(path_or_fileobj=os.path.join(PATH_GAMELOGS,log_filename),
108
+ path_in_repo=os.path.join(PATH_GAMELOGS,log_filename),
109
+ repo_id="sgongora27/PAYADOR-experiments",
110
+ repo_type="space")
111
 
112
  return answer.replace("<",r"\<").replace(">", r"\>")
113