DmitriiKhizbullin commited on
Commit
5ca24d3
1 Parent(s): 97e0caf

Proper sync

Browse files
apps/common/auto_zip.py ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. ===========
2
+ # Licensed under the Apache License, Version 2.0 (the “License”);
3
+ # you may not use this file except in compliance with the License.
4
+ # You may obtain a copy of the License at
5
+ #
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+ #
8
+ # Unless required by applicable law or agreed to in writing, software
9
+ # distributed under the License is distributed on an “AS IS” BASIS,
10
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ # See the License for the specific language governing permissions and
12
+ # limitations under the License.
13
+ # =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. ===========
14
+ import json
15
+ import os
16
+ import zipfile
17
+
18
+
19
+ class AutoZip:
20
+
21
+ def __init__(self, zip_path: str, ext: str = ".json"):
22
+ self.zip_path = zip_path
23
+ self.zip = zipfile.ZipFile(zip_path, "r")
24
+ self.fl = [f for f in self.zip.filelist if f.filename.endswith(ext)]
25
+
26
+ def __next__(self):
27
+ if self.index >= len(self.fl):
28
+ raise StopIteration
29
+ else:
30
+ finfo = self.fl[self.index]
31
+ with self.zip.open(finfo) as f:
32
+ raw_json = json.loads(f.read().decode("utf-8"))
33
+ self.index += 1
34
+ return raw_json
35
+
36
+ def __len__(self):
37
+ return len(self.fl)
38
+
39
+ def __iter__(self):
40
+ self.index = 0
41
+ return self
42
+
43
+ def as_dict(self, include_zip_name: bool = False):
44
+ d = dict()
45
+ for finfo in self.fl:
46
+ with self.zip.open(finfo) as f:
47
+ raw_text = f.read().decode("utf-8")
48
+ if include_zip_name:
49
+ key = os.path.split(self.zip_path)[1] + "/" + finfo.filename
50
+ else:
51
+ key = finfo.filename
52
+ d[key] = raw_text
53
+ return d
data/code/domains.txt ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 1. Accounting
2
+ 2. Agriculture
3
+ 3. Anthropology
4
+ 4. Architecture
5
+ 5. Art
6
+ 6. Biology
7
+ 7. Business
8
+ 8. Chemistry
9
+ 9. Communications
10
+ 10. Computer Science
11
+ 11. Criminal Justice
12
+ 12. Culinary Arts
13
+ 13. Dentistry
14
+ 14. Economics
15
+ 15. Education
16
+ 16. Engineering
17
+ 17. Environmental Science
18
+ 18. Fashion
19
+ 19. Film
20
+ 20. Finance
21
+ 21. Geography
22
+ 22. Geology
23
+ 23. Graphic Design
24
+ 24. Health Sciences
25
+ 25. History
26
+ 26. Hospitality
27
+ 27. Human Resources
28
+ 28. Information Technology
29
+ 29. Journalism
30
+ 30. Law
31
+ 31. Linguistics
32
+ 32. Marketing
33
+ 33. Mathematics
34
+ 34. Mechanical Engineering
35
+ 35. Medicine
36
+ 36. Music
37
+ 37. Nursing
38
+ 38. Nutrition
39
+ 39. Philosophy
40
+ 40. Physics
41
+ 41. Political Science
42
+ 42. Psychology
43
+ 43. Public Administration
44
+ 44. Public Health
45
+ 45. Real Estate
46
+ 46. Sociology
47
+ 47. Sports Science
48
+ 48. Statistics
49
+ 49. Theater
50
+ 50. Urban Planning
data/code/languages.txt ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 1. Java
2
+ 2. Python
3
+ 3. JavaScript
4
+ 4. C#
5
+ 5. PHP
6
+ 6. C++
7
+ 7. Ruby
8
+ 8. Swift
9
+ 9. Objective-C
10
+ 10. SQL
11
+ 11. Go
12
+ 12. Kotlin
13
+ 13. TypeScript
14
+ 14. R
15
+ 15. MATLAB
16
+ 16. Perl
17
+ 17. Shell
18
+ 18. Visual Basic
19
+ 19. Assembly
20
+ 20. Dart
requirements.txt CHANGED
@@ -2,4 +2,5 @@ openai
2
  tenacity
3
  tiktoken
4
  colorama
 
5
  git+https://github.com/lightaime/camel.git@hf_spaces_2
 
2
  tenacity
3
  tiktoken
4
  colorama
5
+ gradio
6
  git+https://github.com/lightaime/camel.git@hf_spaces_2
sync.sh ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ TMP_DIR=/tmp/camel_hf_tmp
2
+ echo $TMP_DIR
3
+ HF_REPO_DIR=`realpath .`
4
+ echo $HF_REPO_DIR
5
+
6
+ mkdir -p $TMP_DIR
7
+ git clone -b hf_spaces_2 https://github.com/lightaime/camel.git $TMP_DIR
8
+ cd $TMP_DIR
9
+
10
+ find apps/agents -name "*.py" | grep -v test | xargs -n 1 -I {} rsync -R {} $HF_REPO_DIR
11
+ find apps/common -name "*.py" | grep -v test | xargs -n 1 -I {} rsync -R {} $HF_REPO_DIR
12
+ find data -name "*.txt" | grep -v test | xargs -n 1 -I {} rsync -R {} $HF_REPO_DIR
13
+
14
+ rm -rf $TMP_DIR