|
|
@ -68,7 +68,11 @@ class PicSearcher extends Component<PicSearcherProps, PicSearcherState> { |
|
|
|
}; |
|
|
|
|
|
|
|
predict = async (imageBase64: any) => { |
|
|
|
const { |
|
|
|
intl: { messages }, |
|
|
|
} = this.props; |
|
|
|
this.setState(() => ({ loading: true })); |
|
|
|
try { |
|
|
|
const res = await fetch( |
|
|
|
'//1647796581073291.cn-shanghai.fc.aliyuncs.com/2016-08-15/proxy/cr-sh.cr-fc-predict__stable/cr-fc-predict/', |
|
|
|
{ |
|
|
@ -83,6 +87,10 @@ class PicSearcher extends Component<PicSearcherProps, PicSearcherState> { |
|
|
|
let icons = await res.json(); |
|
|
|
icons = icons.map((i: any) => ({ score: i.score, type: i.class_name.replace(/\s/g, '-') })); |
|
|
|
this.setState(() => ({ icons, loading: false })); |
|
|
|
} catch (err) { |
|
|
|
message.error(messages['app.docs.components.icon.pic-searcher.server-error']); |
|
|
|
this.setState(() => ({ loading: false })); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
toggleModal = () => { |
|
|
|