mirror of
https://github.com/chenasraf/DefinitelyTyped.git
synced 2026-05-18 01:49:01 +00:00
🤖 Merge PR #62105 [deepai] Add Types by @NicolasNewman
* feat(@types/deepai): added types for deepai * refactor: fixed linting errors * Update types/deepai/index.d.ts Co-authored-by: Piotr Błażejewicz (Peter Blazejewicz) <peterblazejewicz@users.noreply.github.com> * Update types/deepai/index.d.ts Co-authored-by: Piotr Błażejewicz (Peter Blazejewicz) <peterblazejewicz@users.noreply.github.com> * Update types/deepai/index.d.ts Co-authored-by: Piotr Błażejewicz (Peter Blazejewicz) <peterblazejewicz@users.noreply.github.com>
This commit is contained in:
13
types/deepai/deepai-tests.ts
Normal file
13
types/deepai/deepai-tests.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { callStandardApi, setApiKey } from 'deepai';
|
||||
|
||||
// $ExpectedType void
|
||||
setApiKey('');
|
||||
|
||||
// $ExpectedType Promise<{id: string, output_url: string}>
|
||||
callStandardApi('torch-srgan', {image: 'foo.jpg'});
|
||||
|
||||
// @ts-expect-error
|
||||
callStandardApi('torch-srgan', {});
|
||||
|
||||
// @ts-expect-error
|
||||
callStandardApi('foobar', {});
|
||||
40
types/deepai/index.d.ts
vendored
Normal file
40
types/deepai/index.d.ts
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
// Type definitions for deepai 1.0
|
||||
// Project: https://deepai.org/
|
||||
// Definitions by: Nicolas Newman <https://github.com/NicolasNewman>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export as namespace deepai;
|
||||
|
||||
export type Models = 'colorizer'
|
||||
| 'text2img'
|
||||
| 'text-generator'
|
||||
| 'torch-srgan'
|
||||
| 'waifu2x'
|
||||
| 'nsfw-detector'
|
||||
| 'toonify'
|
||||
| 'image-similarity'
|
||||
| 'deepdream'
|
||||
| 'summarization'
|
||||
| 'sentiment-analysis'
|
||||
| 'text-tagging';
|
||||
export interface ModelInputs {
|
||||
'colorizer': {image: string};
|
||||
'text2img': {text: string};
|
||||
'text-generator': {text: string};
|
||||
'torch-srgan': {image: string};
|
||||
'waifu2x': {image: string};
|
||||
'nsfw-detector': {image: string};
|
||||
'toonify': {image: string};
|
||||
'image-similarity': {image1: string, image2: string};
|
||||
'deepdream': {image: string};
|
||||
'summarization': {text: string};
|
||||
'sentiment-analysis': {text: string};
|
||||
'text-tagging': {text: string};
|
||||
}
|
||||
export interface ModelOutputs {
|
||||
'torch-srgan': {id: string, output_url: string};
|
||||
[key: string]: any;
|
||||
}
|
||||
export function setApiKey(apiKey: string): void;
|
||||
/** @async */
|
||||
export function callStandardApi<T extends Models>(modelName: T, inputs_object: ModelInputs[T]): Promise<ModelOutputs[T]>;
|
||||
23
types/deepai/tsconfig.json
Normal file
23
types/deepai/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"deepai-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/deepai/tslint.json
Normal file
1
types/deepai/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "@definitelytyped/dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user