Raiff1982 commited on
Commit
3577c51
·
verified ·
1 Parent(s): e457f10

Create status.js

Browse files
Files changed (1) hide show
  1. status.js +18 -0
status.js ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { Client } from "@gradio/client";
2
+
3
+ function log_status(status) {
4
+ console.log(
5
+ `The current status for this job is: ${JSON.stringify(status, null, 2)}.`
6
+ );
7
+ }
8
+
9
+ const app = await Client.connect("abidlabs/en2fr", {
10
+ events: ["status", "data"]
11
+ });
12
+ const job = app.submit("/predict", ["Hello"]);
13
+
14
+ for await (const message of job) {
15
+ if (message.type === "status") {
16
+ log_status(message);
17
+ }
18
+ }