Skip to content

文本相关API

情绪分析 API-KEY

接口URL

https://api.uniapi.top/text/emotion

请求方式

POST

传参

参数名参数含义参数示例
text文本内容好棒

示例

python
import httpx

url = 'https://api.uniapi.top/text/emotion'
data = {
    "text": "好棒"
}
headers = {
    "API-KEY": "<Your Api-Key>",
    "Content-Type": "application/json"
}
httpx.post(url=url, data=data, headers=headers)
import httpx

url = 'https://api.uniapi.top/text/emotion'
data = {
    "text": "好棒"
}
headers = {
    "API-KEY": "<Your Api-Key>",
    "Content-Type": "application/json"
}
httpx.post(url=url, data=data, headers=headers)
js
const url = 'https://api.uniapi.top/text/emotion'
const data = {
    "text": "好棒"
}
const headers = {
    "API-KEY": "<Your Api-Key>",
    "Content-Type": "application/json"
}
wx.request({
    url: url, 
    header: headers,
    method: "POST",
    data: data,
    success(res){
        console.log(res)
    },
    fail(err){
        console.error(err)
    }
})
const url = 'https://api.uniapi.top/text/emotion'
const data = {
    "text": "好棒"
}
const headers = {
    "API-KEY": "<Your Api-Key>",
    "Content-Type": "application/json"
}
wx.request({
    url: url, 
    header: headers,
    method: "POST",
    data: data,
    success(res){
        console.log(res)
    },
    fail(err){
        console.error(err)
    }
})

返回范例

json
{
    "label": "POSITIVE",
    "score": 0.9996980428695679
}
{
    "label": "POSITIVE",
    "score": 0.9996980428695679
}

答案抽取 API-KEY

接口URL

https://api.uniapi.top/text/question-answer

请求方式

POST

传参

参数名参数含义参数示例
question问题What is the name of the repository?
content文本内容Pipeline has been included in the huggingface/transformers repository.

示例

python
import httpx

url = 'https://api.uniapi.top/text/question-answer'
data = {
    "question": "What is the name of the repository?"
    "answer": "Pipeline has been included in the huggingface/transformers repository."
}
headers = {
    "API-KEY": "<Your Api-Key>",
    "Content-Type": "application/json"
}
httpx.post(url=url, data=data, headers=headers)
import httpx

url = 'https://api.uniapi.top/text/question-answer'
data = {
    "question": "What is the name of the repository?"
    "answer": "Pipeline has been included in the huggingface/transformers repository."
}
headers = {
    "API-KEY": "<Your Api-Key>",
    "Content-Type": "application/json"
}
httpx.post(url=url, data=data, headers=headers)
js
const url = 'https://api.uniapi.top/text/question-answer'
const data = {
    "question": "What is the name of the repository?"
    "answer": "Pipeline has been included in the huggingface/transformers repository."
}
const headers = {
    "API-KEY": "<Your Api-Key>",
    "Content-Type": "application/json"
}
wx.request({
    url: url, 
    header: headers,
    method: "POST",
    data: data,
    success(res){
        console.log(res)
    },
    fail(err){
        console.error(err)
    }
})
const url = 'https://api.uniapi.top/text/question-answer'
const data = {
    "question": "What is the name of the repository?"
    "answer": "Pipeline has been included in the huggingface/transformers repository."
}
const headers = {
    "API-KEY": "<Your Api-Key>",
    "Content-Type": "application/json"
}
wx.request({
    url: url, 
    header: headers,
    method: "POST",
    data: data,
    success(res){
        console.log(res)
    },
    fail(err){
        console.error(err)
    }
})

返回范例

json
{
    "score": 0.9996980428695679,
    "start": 12,
    "end": 20,
    "answer": "huggingface/transformers"
}
{
    "score": 0.9996980428695679,
    "start": 12,
    "end": 20,
    "answer": "huggingface/transformers"
}

Released under the MIT License.