mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-09 22:53:06 -04:00
[api] update to reflect backend
This commit is contained in:
parent
41721f941f
commit
2498e8ac93
2 changed files with 103 additions and 13 deletions
|
@ -7,27 +7,39 @@ const Hosts = Object.freeze({
|
||||||
|
|
||||||
const Api = Object.freeze({
|
const Api = Object.freeze({
|
||||||
HOST: Hosts.prod,
|
HOST: Hosts.prod,
|
||||||
|
|
||||||
GOOGLE_VISION_OCR: '/google/vision/ocr',
|
|
||||||
|
|
||||||
SEARCH_LYRICS: '/search/lyrics',
|
GOOGLE_PERSPECTIVE: '/google/perspective/analyze',
|
||||||
|
GOOGLE_TRANSLATE: '/google/translate/text',
|
||||||
|
GOOGLE_VISION_COLORS: '/google/vision/colors',
|
||||||
|
GOOGLE_VISION_FACES: '/google/vision/faces',
|
||||||
|
GOOGLE_VISION_LABELS: '/google/vision/labels',
|
||||||
|
GOOGLE_VISION_OCR: '/google/vision/ocr',
|
||||||
|
GOOGLE_VISION_SAFETY_LABELS: '/google/vision/safety',
|
||||||
|
GOOGLE_VISION_WEBDETECTION: '/google/vision/webdetection',
|
||||||
|
|
||||||
|
IMAGE_DEEPDREAM: '/image/deepdream',
|
||||||
|
IMAGE_SUPERRESOLUTION: '/image/superresolution',
|
||||||
|
IMAGE_WAIFU2X: '/image/waifu2x',
|
||||||
|
|
||||||
|
PHOTOFUNIA_RETRO_WAVE: '/photofunia/retro-wave',
|
||||||
|
PHOTOFUNIA_YACHT: '/photofunia/yacht',
|
||||||
|
|
||||||
SEARCH_AUDIO: '/search/audio',
|
SEARCH_AUDIO: '/search/audio',
|
||||||
SEARCH_GOOGLE: '/search/google',
|
|
||||||
SEARCH_GOOGLE_IMAGES: '/search/google-images',
|
|
||||||
SEARCH_BING: '/search/bing',
|
SEARCH_BING: '/search/bing',
|
||||||
SEARCH_BING_IMAGES: '/search/bing-images',
|
SEARCH_BING_IMAGES: '/search/bing-images',
|
||||||
|
SEARCH_GOOGLE: '/search/google',
|
||||||
|
SEARCH_GOOGLE_IMAGES: '/search/google-images',
|
||||||
|
SEARCH_LYRICS: '/search/lyrics',
|
||||||
SEARCH_WOLFRAM_ALPHA: '/search/wolfram-alpha',
|
SEARCH_WOLFRAM_ALPHA: '/search/wolfram-alpha',
|
||||||
SEARCH_YOUTUBE: '/search/youtube',
|
SEARCH_YOUTUBE: '/search/youtube',
|
||||||
|
|
||||||
PHOTOFUNIA_YACHT: '/photofunia/yacht',
|
TTS_IMTRANSLATOR: '/tts/imtranslator',
|
||||||
PHOTOFUNIA_RETRO_WAVE: '/photofunia/retro-wave',
|
TTS_POLLY: '/tts/polly',
|
||||||
|
TTS_TIKTOK: '/tts/tiktok',
|
||||||
IMAGE_DEEPDREAM: '/image/deepdream',
|
TTS_VOICEFORGE: '/tts/voiceforge',
|
||||||
IMAGE_WAIFU2X: '/image/waifu2x',
|
|
||||||
IMAGE_SUPERRESOLUTION: '/image/superresolution',
|
|
||||||
|
|
||||||
INFERKIT: '/utils/inferkit',
|
UTILS_INFERKIT: '/utils/inferkit',
|
||||||
|
UTILS_SCREENSHOT: '/utils/screenshot',
|
||||||
})
|
})
|
||||||
|
|
||||||
const Static = Object.freeze({
|
const Static = Object.freeze({
|
||||||
|
|
|
@ -41,12 +41,56 @@ async function request(path, type, headers, args, host) {
|
||||||
throw new Error("unsupported, must either use GET or POST");
|
throw new Error("unsupported, must either use GET or POST");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module.exports.googlePerspective = async function(context, text){
|
||||||
|
return await request(Api.GOOGLE_PERSPECTIVE, "GET", {}, {
|
||||||
|
text: text
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.googleTranslate = async function(context, text, to, from){
|
||||||
|
return await request(Api.GOOGLE_TRANSLATE, "GET", {}, {
|
||||||
|
text: text,
|
||||||
|
to: to,
|
||||||
|
from: from
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.googleVisionColors = async function(context, url){
|
||||||
|
return await request(Api.GOOGLE_VISION_COLORS, "GET", {}, {
|
||||||
|
url: url
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.googleVisionFaces = async function(context, url){
|
||||||
|
return await request(Api.GOOGLE_VISION_FACES, "GET", {}, {
|
||||||
|
url: url
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.googleVisionLabels = async function(context, url){
|
||||||
|
return await request(Api.GOOGLE_VISION_LABELS, "GET", {}, {
|
||||||
|
url: url
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
module.exports.googleVisionOcr = async function(context, url){
|
module.exports.googleVisionOcr = async function(context, url){
|
||||||
return await request(Api.GOOGLE_VISION_OCR, "GET", {}, {
|
return await request(Api.GOOGLE_VISION_OCR, "GET", {}, {
|
||||||
url: url
|
url: url
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module.exports.googleVisionSafetyLabels = async function(context, url){
|
||||||
|
return await request(Api.GOOGLE_VISION_SAFETY_LABELS, "GET", {}, {
|
||||||
|
url: url
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.googleVisionWebDetection = async function(context, url){
|
||||||
|
return await request(Api.GOOGLE_VISION_WEBDETECTION, "GET", {}, {
|
||||||
|
url: url
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
module.exports.searchAudio = async function(context, url){
|
module.exports.searchAudio = async function(context, url){
|
||||||
return await request(Api.SEARCH_AUDIO, "GET", {}, {
|
return await request(Api.SEARCH_AUDIO, "GET", {}, {
|
||||||
url: url
|
url: url
|
||||||
|
@ -129,12 +173,46 @@ module.exports.superresolution = async function(context, url){
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module.exports.imtranslator = async function(context, text, voice){
|
||||||
|
return await request(Api.TTS_IMTRANSLATOR, "GET", {}, {
|
||||||
|
text: text,
|
||||||
|
voice: voice
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.polly = async function(context, text, voice){
|
||||||
|
return await request(Api.TTS_POLLY, "GET", {}, {
|
||||||
|
text: text,
|
||||||
|
voice: voice
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.tiktok = async function(context, text, voice){
|
||||||
|
return await request(Api.TTS_TIKTOK, "GET", {}, {
|
||||||
|
text: text,
|
||||||
|
voice: voice
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.voiceforge = async function(context, text, voice){
|
||||||
|
return await request(Api.TTS_VOICEFORGE, "GET", {}, {
|
||||||
|
text: text,
|
||||||
|
voice: voice
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
module.exports.inferkit = async function(context, input){
|
module.exports.inferkit = async function(context, input){
|
||||||
return await request(Api.INFERKIT, "GET", {}, {
|
return await request(Api.UTILS_INFERKIT, "GET", {}, {
|
||||||
input: input
|
input: input
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module.exports.screenshot = async function(context, url){
|
||||||
|
return await request(Api.UTILS_SCREENSHOT, "GET", {}, {
|
||||||
|
url: url
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
module.exports.emojiTwitter = async function(codepoint){
|
module.exports.emojiTwitter = async function(codepoint){
|
||||||
return Static.HOST + Static.TWITTER(codepoint)
|
return Static.HOST + Static.TWITTER(codepoint)
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue