mirror of
https://github.com/gradio-app/gradio.git
synced 2025-04-12 12:40:29 +08:00
Ensure all status are reported internally when calling predict
(#8485)
* fix param name * format * fix * add changeset --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
parent
c79639448c
commit
f8ebacecce
6
.changeset/quiet-colts-burn.md
Normal file
6
.changeset/quiet-colts-burn.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
"@gradio/client": minor
|
||||
"gradio": minor
|
||||
---
|
||||
|
||||
feat:Ensure all status are reported internally when calling `predict`
|
@ -102,7 +102,8 @@ export class Client {
|
||||
endpoint: string | number,
|
||||
data: unknown[] | Record<string, unknown>,
|
||||
event_data?: unknown,
|
||||
trigger_id?: number | null
|
||||
trigger_id?: number | null,
|
||||
all_events?: boolean
|
||||
) => SubmitIterable<GradioEvent>;
|
||||
predict: (
|
||||
endpoint: string | number,
|
||||
|
@ -30,7 +30,7 @@ export async function predict(
|
||||
}
|
||||
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const app = this.submit(endpoint, data);
|
||||
const app = this.submit(endpoint, data, null, null, true);
|
||||
let result: unknown;
|
||||
|
||||
for await (const message of app) {
|
||||
|
@ -28,7 +28,8 @@ export function submit(
|
||||
endpoint: string | number,
|
||||
data: unknown[] | Record<string, unknown>,
|
||||
event_data?: unknown,
|
||||
trigger_id?: number | null
|
||||
trigger_id?: number | null,
|
||||
all_events?: boolean
|
||||
): SubmitIterable<GradioEvent> {
|
||||
try {
|
||||
const { hf_token } = this.options;
|
||||
@ -87,7 +88,7 @@ export function submit(
|
||||
|
||||
// event subscription methods
|
||||
function fire_event(event: GradioEvent): void {
|
||||
if (events_to_publish[event.type]) {
|
||||
if (all_events || events_to_publish[event.type]) {
|
||||
push_event(event);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user