KonradSzafer commited on
Commit
76cb82a
1 Parent(s): 0bd8ed4

faster update space

Browse files
Files changed (2) hide show
  1. qa_engine/config.py +1 -1
  2. update_space.py +16 -4
qa_engine/config.py CHANGED
@@ -36,7 +36,7 @@ class Config:
36
 
37
  # Discord bot config - optional
38
  discord_token: str = get_env('DISCORD_TOKEN', '-', warn=False)
39
- discotd_channel_ids: list[int] = eval(get_env('DISCORD_CHANNEL_IDS', [], warn=False))
40
  num_last_messages: int = int(get_env('NUM_LAST_MESSAGES', 2, warn=False))
41
  use_names_in_context: bool = eval(get_env('USE_NAMES_IN_CONTEXT', 'False', warn=False))
42
  enable_commands: bool = eval(get_env('ENABLE_COMMANDS', 'True', warn=False))
 
36
 
37
  # Discord bot config - optional
38
  discord_token: str = get_env('DISCORD_TOKEN', '-', warn=False)
39
+ discotd_channel_ids: list[int] = get_env('DISCORD_CHANNEL_IDS', [], warn=False)
40
  num_last_messages: int = int(get_env('NUM_LAST_MESSAGES', 2, warn=False))
41
  use_names_in_context: bool = eval(get_env('USE_NAMES_IN_CONTEXT', 'False', warn=False))
42
  enable_commands: bool = eval(get_env('ENABLE_COMMANDS', 'True', warn=False))
update_space.py CHANGED
@@ -1,6 +1,7 @@
1
  import os
2
  import shutil
3
  import subprocess
 
4
  from pathlib import Path
5
 
6
 
@@ -21,7 +22,7 @@ def remove_old_files():
21
 
22
  def clone_repository():
23
  repo_url = 'https://github.com/KonradSzafer/hugging-face-qa-bot.git'
24
- subprocess.run(['git', 'clone', repo_url])
25
 
26
 
27
  def copy_files():
@@ -37,7 +38,18 @@ def copy_files():
37
  shutil.rmtree(src)
38
 
39
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  if __name__ == '__main__':
41
- remove_old_files()
42
- clone_repository()
43
- copy_files()
 
1
  import os
2
  import shutil
3
  import subprocess
4
+ import warnings
5
  from pathlib import Path
6
 
7
 
 
22
 
23
  def clone_repository():
24
  repo_url = 'https://github.com/KonradSzafer/hugging-face-qa-bot.git'
25
+ subprocess.run(['git', 'clone', '--depth', '1', repo_url])
26
 
27
 
28
  def copy_files():
 
38
  shutil.rmtree(src)
39
 
40
 
41
+ def main():
42
+ path = os.getcwd().lower()
43
+ current_dir = path.split('/')[-1]
44
+ if current_dir != 'hugging-face-qa-bot':
45
+ print('Updating the HF space...')
46
+ remove_old_files()
47
+ clone_repository()
48
+ copy_files()
49
+ else:
50
+ warnings.warn('You are in the hugging-face-qa-bot reposotory')
51
+
52
+
53
  if __name__ == '__main__':
54
+ main()
55
+