Skip to content

Commit 0466022

Browse files
authored
Rename modelId to id (#442)
* 👀: the important part of the PR * auto-linting * rename model.modelId => model.id
1 parent 1caa3d1 commit 0466022

File tree

26 files changed

+134
-131
lines changed

26 files changed

+134
-131
lines changed

docs/hub/adding-a-library.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Add a code snippet by updating the [Libraries Typescript file](https://github.co
9595
const asteroid = (model: ModelData) =>
9696
`from asteroid.models import BaseModel
9797
98-
model = BaseModel.from_pretrained("${model.modelId}")`;
98+
model = BaseModel.from_pretrained("${model.id}")`;
9999
```
100100

101101
This will also add a tag to your model so users can quickly identify models from your library.

docs/hub/tutorial-add-library.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Add a code snippet by updating the [Libraries Typescript file](https://github.co
9595
const asteroid = (model: ModelData) =>
9696
`from asteroid.models import BaseModel
9797
98-
model = BaseModel.from_pretrained("${model.modelId}")`;
98+
model = BaseModel.from_pretrained("${model.id}")`;
9999
```
100100

101101
This will also add a tag to your model so users can quickly identify models from your library.

widgets/src/lib/InferenceWidget/shared/WidgetWrapper/WidgetWrapper.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
.slice(0, 5);
3636
3737
onMount(() => {
38-
getModelStatus(apiUrl, model.modelId).then((status) => {
38+
getModelStatus(apiUrl, model.id).then((status) => {
3939
modelStatus = status;
4040
});
4141
});

widgets/src/lib/InferenceWidget/shared/helpers.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export function proxify(url: string): string {
4949

5050
async function callApi(
5151
url: string,
52-
modelId: string,
52+
repoId: string,
5353
requestBody: Record<string, any>,
5454
apiToken = '',
5555
waitForModel = false, // If true, the server will only respond once the model has been loaded on the inference API,
@@ -76,7 +76,7 @@ async function callApi(
7676
: JSON.stringify(requestBody);
7777

7878
return await fetch(
79-
`${url}/models/${modelId}`,
79+
`${url}/models/${repoId}`,
8080
{
8181
method: "POST",
8282
body,
@@ -87,7 +87,7 @@ async function callApi(
8787

8888
export async function getResponse<T>(
8989
url: string,
90-
modelId: string,
90+
repoId: string,
9191
requestBody: Record<string, any>,
9292
apiToken = '',
9393
outputParsingFn: (x: unknown) => T,
@@ -109,7 +109,7 @@ export async function getResponse<T>(
109109
}> {
110110
const response = await callApi(
111111
url,
112-
modelId,
112+
repoId,
113113
requestBody,
114114
apiToken,
115115
waitForModel,
@@ -157,8 +157,8 @@ export async function getResponse<T>(
157157
}
158158

159159

160-
export async function getModelStatus(url: string, modelId: string): Promise<LoadingStatus> {
161-
const response = await fetch(`${url}/status/${modelId}`);
160+
export async function getModelStatus(url: string, repoId: string): Promise<LoadingStatus> {
161+
const response = await fetch(`${url}/status/${repoId}`);
162162
const output = await response.json();
163163
if (response.ok && typeof output === 'object' && output.loaded !== undefined) {
164164
return output.loaded ? 'loaded' : 'unknown';

widgets/src/lib/InferenceWidget/widgets/AudioClassificationWidget/AudioClassificationWidget.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
8787
const res = await getResponse(
8888
apiUrl,
89-
model.modelId,
89+
model.id,
9090
requestBody,
9191
apiToken,
9292
parseOutput,

widgets/src/lib/InferenceWidget/widgets/AudioToAudioWidget/AudioToAudioWidget.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
8989
const res = await getResponse(
9090
apiUrl,
91-
model.modelId,
91+
model.id,
9292
requestBody,
9393
apiToken,
9494
parseOutput,

widgets/src/lib/InferenceWidget/widgets/AutomaticSpeechRecognitionWidget/AutomaticSpeechRecognitionWidget.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
8787
const res = await getResponse(
8888
apiUrl,
89-
model.modelId,
89+
model.id,
9090
requestBody,
9191
apiToken,
9292
parseOutput,

widgets/src/lib/InferenceWidget/widgets/ConversationalWidget/ConversationalWidget.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
9191
const res = await getResponse(
9292
apiUrl,
93-
model.modelId,
93+
model.id,
9494
requestBody,
9595
apiToken,
9696
parseOutput,
@@ -169,7 +169,7 @@
169169
{outputJson}
170170
>
171171
<svelte:fragment slot="top">
172-
<WidgetOutputConvo modelId={model.modelId} {output} />
172+
<WidgetOutputConvo modelId={model.id} {output} />
173173
<form>
174174
<WidgetQuickInput
175175
bind:value={text}

widgets/src/lib/InferenceWidget/widgets/FeatureExtractionWidget/FeatureExtractionWidget.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
6767
const res = await getResponse(
6868
apiUrl,
69-
model.modelId,
69+
model.id,
7070
requestBody,
7171
apiToken,
7272
parseOutput,

widgets/src/lib/InferenceWidget/widgets/FillMaskWidget/FillMaskWidget.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
6767
const res = await getResponse(
6868
apiUrl,
69-
model.modelId,
69+
model.id,
7070
requestBody,
7171
apiToken,
7272
parseOutput,

0 commit comments

Comments
 (0)