@@ -160,6 +160,96 @@ curl --location --request POST 'https://www.modelfun.cn/modelfun/api/serving_api
160
160
</tr >
161
161
</table >
162
162
163
+
164
+ ### 文本理解
165
+ <table >
166
+ <tr >
167
+ <td > python 🔐 </td >
168
+ <td > curl 🔐⚡⚡ </td >
169
+ </tr >
170
+
171
+ <tr >
172
+ <td >
173
+
174
+ ``` python
175
+ import clueai
176
+ from clueai.classify import Example
177
+ cl = clueai.Client(" " , check_api_key = False )
178
+ response = cl.classify(
179
+ model_name = ' clueai-base' ,
180
+ task_name = ' 产品分类' ,
181
+ inputs = [" 强大图片处理器,展现自然美丽的你,,修复部分小错误,提升整体稳定性。" , " 求闲置买卖,精品购物,上畅易无忧闲置商城,安全可信,优质商品有保障" ],
182
+ labels = [" 美颜" , " 二手" , " 外卖" , " 办公" , " 求职" ])
183
+ print (' prediction: {} ' .format(response.classifications))
184
+ ```
185
+ </td >
186
+ <td >
187
+
188
+ ``` python
189
+ curl -- location -- request POST ' https://www.modelfun.cn/modelfun/api/serving_api' \
190
+ -- header ' Content-Type: application/json' \
191
+ -- header ' Model-name: clueai-base' \
192
+ -- data ' {
193
+ " task_type" : " classify" ,
194
+ " task_name" : " 产品分类" ,
195
+ " input_data" : [" 强大图片处理器,展现自然美丽的你,,修复部分小错误,提升整体稳定性。" , " 求闲置买卖,精品购物,上畅易无忧闲置商城,安全可信,优质商品有保障" ],
196
+ " labels" : [" 美颜" , " 二手" , " 外卖" , " 办公" , " 求职" ]
197
+ }'
198
+
199
+ ```
200
+ </td >
201
+
202
+ </tr >
203
+ </table >
204
+
205
+ ### 信息抽取(NER)
206
+ <table >
207
+ <tr >
208
+ <td > python 🔐 </td >
209
+ <td > curl 🔐⚡⚡ </td >
210
+ </tr >
211
+
212
+ <tr >
213
+ <td >
214
+
215
+ ``` python
216
+ import clueai
217
+
218
+ # initialize the Clueai Client with an API Key
219
+ cl = clueai.Client(" " , check_api_key = False )
220
+ prompt= '''
221
+ 信息抽取:
222
+ 据新华社电广东省清远市清城区政府昨日对外发布信息称,日前被实名举报涉嫌勒索企业、说“分分钟可以搞垮一间厂”的清城区环保局局长陈柏,已被免去清城区区委委员
223
+ 问题:机构名,人名,职位
224
+ 答案:
225
+ '''
226
+ prediction = cl.generate(
227
+ model_name = ' clueai-base' ,
228
+ prompt = prompt)
229
+ # 需要返回得分的话,指定return_likelihoods="GENERATION"
230
+
231
+ # print the predicted text
232
+ print (' prediction: {} ' .format(prediction.generations[0 ].text))
233
+ ```
234
+ </td >
235
+ <td >
236
+
237
+ ``` python
238
+ curl -- location -- request POST ' https://www.modelfun.cn/modelfun/api/serving_api' \
239
+ -- header ' Content-Type: application/json' \
240
+ -- header ' Model-name: clueai-base' \
241
+ -- data ' {
242
+ " task_type" : " generate" ,
243
+ " task_name" : " 信息抽取" ,
244
+ " input_data" : [" 信息抽取:\n 据新华社电广东省清远市清城区政府昨日对外发布信息称,日前被实名举报涉嫌勒索企业、说“分分钟可以搞垮一间厂”的清城区环保局局长陈柏,已被免去清城区区委委员\n 问题:机构名,人名,职位\n 答案:" ]
245
+ }'
246
+
247
+ ```
248
+ </td >
249
+
250
+ </tr >
251
+ </table >
252
+
163
253
### 文本生成
164
254
<table >
165
255
<tr >
0 commit comments