Commit d79810d5cacde62dfb407ebc5113a9bfa31ef9b5
1 parent
be52af70
first commit
Showing
3 changed files
with
166 additions
and
6 deletions
Show diff stats
| ... | ... | @@ -0,0 +1,142 @@ |
| 1 | +# Prerequisites | |
| 2 | +*.d | |
| 3 | + | |
| 4 | +# Compiled Object files | |
| 5 | +*.slo | |
| 6 | +*.lo | |
| 7 | +*.o | |
| 8 | +*.obj | |
| 9 | + | |
| 10 | +# Precompiled Headers | |
| 11 | +*.gch | |
| 12 | +*.pch | |
| 13 | + | |
| 14 | +# Compiled Dynamic libraries | |
| 15 | +*.so | |
| 16 | +*.dylib | |
| 17 | +*.dll | |
| 18 | + | |
| 19 | +# Fortran module files | |
| 20 | +*.mod | |
| 21 | +*.smod | |
| 22 | + | |
| 23 | +# Compiled Static libraries | |
| 24 | +*.lai | |
| 25 | +*.la | |
| 26 | +*.a | |
| 27 | +*.lib | |
| 28 | + | |
| 29 | +# Executables | |
| 30 | +*.exe | |
| 31 | +*.out | |
| 32 | +*.app | |
| 33 | + | |
| 34 | +# Projects | |
| 35 | +.vscode | |
| 36 | + | |
| 37 | +data/* | |
| 38 | +model/* | |
| 39 | +model.bin.* | |
| 40 | +*.pyc | |
| 41 | +*.swp | |
| 42 | +.pydevproject | |
| 43 | +.DS_Store | |
| 44 | +.project | |
| 45 | +.idea | |
| 46 | +.data | |
| 47 | +__pycache__ | |
| 48 | +*.log | |
| 49 | +*.bak*/ | |
| 50 | +.history.txt | |
| 51 | +log/ | |
| 52 | +logs/ | |
| 53 | +nohup.out | |
| 54 | +temp/ | |
| 55 | +indexer_input* | |
| 56 | +log.* | |
| 57 | +data | |
| 58 | +output | |
| 59 | +data.* | |
| 60 | +*.json | |
| 61 | +*.idx | |
| 62 | +*.npy | |
| 63 | +*.tgz | |
| 64 | +*.tar.gz | |
| 65 | +*.tar | |
| 66 | +*.pt | |
| 67 | + | |
| 68 | +*.log | |
| 69 | +log/ | |
| 70 | + | |
| 71 | +*.csv | |
| 72 | +*.json | |
| 73 | +*.txt | |
| 74 | +*.jsonl | |
| 75 | +*.jsonl.gz | |
| 76 | +*.jsonl.gz.part | |
| 77 | + | |
| 78 | +setup_env.sh | |
| 79 | +clip_cn_rn50.pt | |
| 80 | +clip_cn_vit-b-16.pt | |
| 81 | +*.pt | |
| 82 | +*.pth | |
| 83 | +*.pth.tar | |
| 84 | +*.pth.tar.gz | |
| 85 | +*.pth.tar.gz.part | |
| 86 | +log_* | |
| 87 | +pic_logs/* | |
| 88 | +*.faiss | |
| 89 | +*.pkl | |
| 90 | +*.txt | |
| 91 | +pic_data | |
| 92 | +embeddings | |
| 93 | +yolov8x* | |
| 94 | +*.pt | |
| 95 | +*.pth | |
| 96 | +*.pth.tar | |
| 97 | +*.pth.tar.gz | |
| 98 | +*.pth.tar.gz.part | |
| 99 | +*.pt.* | |
| 100 | +*copy.py | |
| 101 | +*\ copy.* | |
| 102 | + | |
| 103 | +a | |
| 104 | +aa | |
| 105 | +bb | |
| 106 | +cc | |
| 107 | +dd | |
| 108 | +aaa | |
| 109 | +bbb | |
| 110 | +ccc | |
| 111 | +ddd | |
| 112 | +aaaa | |
| 113 | +bbbb | |
| 114 | +cccc | |
| 115 | +dddd | |
| 116 | +a | |
| 117 | +b | |
| 118 | +c | |
| 119 | +d | |
| 120 | +tmp | |
| 121 | +*.png | |
| 122 | +*.xlsx | |
| 123 | +*.csv | |
| 124 | +*.jsonl | |
| 125 | +*.json | |
| 126 | + | |
| 127 | +output | |
| 128 | + | |
| 129 | +bulk_data | |
| 130 | +*.top1w | |
| 131 | +*.top10w | |
| 132 | + | |
| 133 | +warmup_output | |
| 134 | +*output/* | |
| 135 | + | |
| 136 | +*_bak/ | |
| 137 | +bak_* | |
| 138 | +bak | |
| 139 | + | |
| 140 | +dict/*/* | |
| 141 | +dict/chat_search/ | |
| 142 | +dict/goods_attribute_mapping/ | |
| 0 | 143 | \ No newline at end of file | ... | ... |
query/translator.py
| ... | ... | @@ -39,10 +39,18 @@ class Translator: |
| 39 | 39 | Initialize translator. |
| 40 | 40 | |
| 41 | 41 | Args: |
| 42 | - api_key: DeepL API key (or None to use mock) | |
| 42 | + api_key: DeepL API key (or None to use from config/env) | |
| 43 | 43 | use_cache: Whether to cache translations |
| 44 | 44 | timeout: Request timeout in seconds |
| 45 | 45 | """ |
| 46 | + # Get API key from config if not provided | |
| 47 | + if api_key is None: | |
| 48 | + try: | |
| 49 | + from config.env_config import get_deepl_key | |
| 50 | + api_key = get_deepl_key() | |
| 51 | + except ImportError: | |
| 52 | + pass | |
| 53 | + | |
| 46 | 54 | self.api_key = api_key |
| 47 | 55 | self.timeout = timeout |
| 48 | 56 | self.use_cache = use_cache | ... | ... |
utils/es_client.py
| ... | ... | @@ -229,8 +229,18 @@ def get_es_client_from_env() -> ESClient: |
| 229 | 229 | Returns: |
| 230 | 230 | ESClient instance |
| 231 | 231 | """ |
| 232 | - return ESClient( | |
| 233 | - hosts=[os.getenv('ES_HOST', 'http://localhost:9200')], | |
| 234 | - username=os.getenv('ES_USERNAME'), | |
| 235 | - password=os.getenv('ES_PASSWORD') | |
| 236 | - ) | |
| 232 | + try: | |
| 233 | + from config.env_config import get_es_config | |
| 234 | + es_config = get_es_config() | |
| 235 | + return ESClient( | |
| 236 | + hosts=[es_config['host']], | |
| 237 | + username=es_config.get('username'), | |
| 238 | + password=es_config.get('password') | |
| 239 | + ) | |
| 240 | + except ImportError: | |
| 241 | + # Fallback to env variables | |
| 242 | + return ESClient( | |
| 243 | + hosts=[os.getenv('ES_HOST', 'http://localhost:9200')], | |
| 244 | + username=os.getenv('ES_USERNAME'), | |
| 245 | + password=os.getenv('ES_PASSWORD') | |
| 246 | + ) | ... | ... |