4d7dd9d
chenzhiqing 3 years ago
3 changed file(s) with 11 addition(s) and 244 deletion(s). Raw diff Collapse all Expand all
2020 t = time.time()
2121 return inner
2222
23 def load_demo_image(img, image_size, device):
24 if "http" in img_url:
25 # img_url = 'https://storage.googleapis.com/sfr-vision-language-research/BLIP/demo.jpg'
26 raw_image = Image.open(requests.get(img_url, stream=True).raw).convert('RGB')
27 else:
28 raw_image = Image.open(img_url).convert('RGB')
29
30 w,h = raw_image.size
23 def load_demo_image(base64_str, image_size, device):
24 img = Image.open(base64_str)
25 raw_image = np.array(img.convert("RGB"))
3126
3227 transform = transforms.Compose([
3328 transforms.Resize((image_size,image_size),interpolation=InterpolationMode.BICUBIC),
4641
4742
4843 def handle(conf):
49 image_url = conf['Photo'] # value_type: str # description: some description
44 base64_str = conf['Photo'] # value_type: str # description: some description
5045 question = conf['Question']
51 image = load_demo_image(image_url, image_size, device)
46 image = load_demo_image(base64_str, image_size, device)
5247 res = inference(model, image, question)
5348 print('Answer :', res)
5449 # add your code
99 thinc==7.4.1
1010 charset-normalizer==2.0.12
1111 nltk==3.5
12 transformers==4.15.0
12 transformers==4.1.1
1313 astunparse==1.6.3
1414 PyWavelets==1.2.0
1515 semantic-version==2.8.5
3939 s3transfer==0.3.3
4040 networkx==2.6.3
4141 catalogue==1.0.0
42 fairscale==0.4.4
42 openpyxl==2.6.4
4343 dm-tree==0.1.6
4444 imageio==2.8.0
4545 metakernel==0.28.2
4646 opt-einsum==3.3.0
4747 cachetools==3.1.1
4848 smart-open==5.2.1
49 timm==0.4.12
49 timm==0.5.4
5050 multipledispatch==0.6.0
5151 argon2-cffi==21.3.0
52 pycocoevalcap==1.2
5352 tinycss2==1.1.1
5453 graphviz==0.14
5554 minio==5.0.10
8079 cryptography==36.0.1
8180 python-json-logger==2.0.2
8281 ruamel.yaml==0.17.21
83 pycocotools==2.0.4
8482 pyglet==1.5.0
8583 cymem==2.0.6
8684 Shapely==1.7.0
10098 xlrd==1.2.0
10199 numpyencoder==0.3.0
102100 copulas==0.3.3
103 torch==1.11.0
101 torch==1.4.0+cpu
104102 typeguard==2.13.3
105103 pyOpenSSL==22.0.0
106104 matplotlib-inline==0.1.3
107105 tqdm==4.46.1
108 torchvision==0.12.0
106 torchvision==0.5.0+cpu
109107 wrapt==1.13.3
110108 google-auth-oauthlib==0.4.6
111 huggingface-hub==0.7.0
112109 pycparser==2.21
113110 filelock==3.6.0
114111 botocore==1.19.25
140137 pyrsistent==0.18.1
141138 imgaug==0.4.0
142139 asttokens==2.0.5
143 tokenizers==0.10.3
144 openpyxl==2.6.4
140 tokenizers==0.9.4
+0
-224
reset_requirements.txt less more
0 absl-py==0.9.0
1 alembic==1.7.6
2 argon2-cffi==21.3.0
3 argon2-cffi-bindings==21.2.0
4 astor==0.8.1
5 asttokens==2.0.5
6 astunparse==1.6.3
7 async-generator==1.10
8 attrs==19.3.0
9 Augmentor==0.2.8
10 backcall==0.2.0
11 baytune==0.3.12
12 bleach==4.1.0
13 blis==0.4.1
14 boto3==1.16.25
15 botocore==1.19.25
16 cachetools==3.1.1
17 cairocffi==1.3.0
18 CairoSVG==2.5.2
19 calysto==1.0.6
20 catalogue==1.0.0
21 certifi==2021.10.8
22 certipy==0.1.3
23 cffi==1.15.0
24 charset-normalizer==2.0.12
25 click==8.0.4
26 cloudpickle==1.2.2
27 cmake==3.21.1
28 configparser==5.2.0
29 copulas==0.3.3
30 cryptography==36.0.1
31 cssselect2==0.4.1
32 cycler==0.11.0
33 cymem==2.0.6
34 Cython==0.29.20
35 debugpy==1.5.1
36 decorator==5.1.1
37 defusedxml==0.7.1
38 distlib==0.3.4
39 dlib==19.22.0
40 dm-tree==0.1.6
41 easydict==1.9
42 en-core-web-sm @ https://files.momodel.cn/en_core_web_sm-2.3.0.tar.gz
43 entrypoints==0.4
44 et-xmlfile==1.1.0
45 fairscale==0.4.4
46 filelock==3.6.0
47 func-timeout==4.3.5
48 future==0.18.2
49 gast==0.3.3
50 gensim==3.8.3
51 google-auth==2.6.0
52 google-auth-oauthlib==0.4.6
53 google-pasta==0.2.0
54 graphviz==0.14
55 greenlet==1.1.2
56 grpcio==1.29.0
57 gym==0.15.7
58 h5py==2.10.0
59 huggingface-hub==0.7.0
60 idna==3.3
61 imageio==2.8.0
62 imbalanced-learn==0.6.2
63 imgaug==0.4.0
64 importlib-metadata==4.11.1
65 importlib-resources==5.4.0
66 install==1.3.5
67 ipdb==0.13.2
68 ipykernel==6.9.1
69 ipython==7.31.1
70 ipython-genutils==0.2.0
71 ipywidgets==7.4.0
72 jdcal==1.4.1
73 jedi==0.18.1
74 jieba==0.42.1
75 Jinja2==3.0.3
76 jmespath==0.10.0
77 joblib==1.1.0
78 jsonschema==4.4.0
79 jupyter-client==7.1.2
80 jupyter-core==4.9.2
81 jupyter-telemetry==0.1.0
82 jupyterhub==1.4.2
83 jupyterlab==1.0.0a1
84 jupyterlab-server==0.2.0
85 kanren==0.2.3
86 Keras==2.4.3
87 Keras-Preprocessing==1.1.2
88 kiwisolver==1.3.2
89 Mako==1.1.6
90 Markdown==3.3.6
91 MarkupSafe==2.1.0
92 matplotlib==3.0.3
93 matplotlib-inline==0.1.3
94 metakernel==0.28.2
95 mindspore @ https://ms-release.obs.cn-north-4.myhuaweicloud.com/1.0.0/MindSpore/cpu/ubuntu_x86/mindspore-1.0.0-cp37-cp37m-linux_x86_64.whl
96 minepy==1.2.4
97 minio==5.0.10
98 mistune==0.8.4
99 mpmath==1.2.1
100 multipledispatch==0.6.0
101 murmurhash==1.0.6
102 nbconvert==5.6.1
103 nbformat==5.1.3
104 nest-asyncio==1.5.4
105 networkx==2.6.3
106 nltk==3.5
107 notebook==6.2.0
108 numpy==1.18.5
109 numpyencoder==0.3.0
110 oauthlib==3.2.0
111 opencv-python==4.5.1.48
112 openpyxl==2.6.4
113 opt-einsum==3.3.0
114 packaging==21.3
115 paddlepaddle==2.0.1
116 pamela==1.0.0
117 pandas==0.24.2
118 pandocfilters==1.5.0
119 parso==0.8.3
120 pbr==5.8.1
121 pexpect==4.8.0
122 pickleshare==0.7.5
123 Pillow==8.1.0
124 plac==1.1.3
125 platformdirs==2.5.1
126 plotly==4.8.1
127 portpicker==1.3.9
128 preshed==3.0.6
129 prometheus-client==0.13.1
130 prompt-toolkit==3.0.28
131 protobuf==3.19.4
132 ptyprocess==0.7.0
133 pyasn1==0.4.8
134 pyasn1-modules==0.2.8
135 PyAudio==0.2.11
136 pycocoevalcap==1.2
137 pycocotools==2.0.4
138 pycparser==2.21
139 pydot==1.4.1
140 pygame==2.0.1
141 pyglet==1.5.0
142 Pygments==2.11.2
143 pyOpenSSL==22.0.0
144 pyparsing==3.0.7
145 pyrsistent==0.18.1
146 python-dateutil==2.8.2
147 python-json-logger==2.0.2
148 pytorch-pretrained-bert==0.6.2
149 pytorch-transformers==1.2.0
150 pytz==2021.3
151 PyWavelets==1.2.0
152 PyYAML==6.0
153 pyzmq==22.3.0
154 regex==2022.1.18
155 requests==2.27.1
156 requests-oauthlib==1.3.1
157 retrying==1.3.3
158 rouge==1.0.0
159 rsa==4.8
160 ruamel.yaml==0.17.21
161 ruamel.yaml.clib==0.2.6
162 s3transfer==0.3.3
163 sacremoses==0.0.47
164 scikit-image==0.15.0
165 scikit-learn==0.22.2.post1
166 scipy==1.3.3
167 seaborn==0.10.1
168 semantic-version==2.8.5
169 Send2Trash==1.8.0
170 sentencepiece==0.1.91
171 Shapely==1.7.0
172 six==1.16.0
173 smart-open==5.2.1
174 spacy==2.3.2
175 SQLAlchemy==1.4.31
176 srsly==1.0.5
177 stevedore==3.5.0
178 svgwrite==1.4.1
179 sympy==1.6.2
180 tensorboard==2.8.0
181 tensorboard-data-server==0.6.1
182 tensorboard-plugin-wit==1.8.1
183 tensorboardX==2.0
184 tensorflow==2.3.1
185 tensorflow-addons==0.11.2
186 tensorflow-estimator==2.3.0
187 tensorflow-federated==0.17.0
188 tensorflow-model-optimization==0.4.1
189 tensorflow-privacy==0.5.2
190 termcolor==1.1.0
191 terminado==0.13.1
192 testpath==0.5.0
193 tf-slim==1.1.0
194 thinc==7.4.1
195 timm==0.4.12
196 tinycss2==1.1.1
197 tokenizers==0.10.3
198 toolz==0.11.2
199 torch==1.11.0
200 torchtext==0.6.0
201 torchvision==0.12.0
202 tornado==6.1
203 tqdm==4.46.1
204 traitlets==5.1.1
205 transformers==4.15.0
206 typeguard==2.13.3
207 typing-extensions==4.1.1
208 unification==0.2.2
209 urllib3==1.26.8
210 virtualenv==20.13.1
211 virtualenv-clone==0.5.7
212 virtualenvwrapper==4.7.0
213 wasabi==0.9.0
214 wcwidth==0.2.5
215 webencodings==0.5.1
216 Werkzeug==2.0.3
217 widgetsnbextension==3.4.2
218 word2vec==0.11.1
219 wrapt==1.13.3
220 xlrd==1.2.0
221 XlsxWriter==1.4.3
222 yellowbrick==1.1
223 zipp==3.7.0