gradio/client/js/index.html
pngwn 9d2d6051ca
Change client submit API to be an AsyncIterable and support more platforms (#8451)
* fix param name

* format

* save

* changes

* changes

* fix param name

* format

* switch to async iterable interface

* switch to async iterable interface

* changes

* add changeset

* fix

* fix param name

* format

* fixes

* fix checks

* fix checks

* add changeset

* fix checks

* add changeset

* add changeset

* fix checks

* fix param name

* format

* fix types

* cleanup comments

* add changeset

* fix param name

* format

* changes

* Refactor Cancelling Logic To Use /cancel (#8370)

* Cancel refactor

* add changeset

* add changeset

* types

* Add code

* Fix types

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>

* fix param name

* format

* changes

* fix

* fix param name

* format

* fix test

* fix notebooks

* fix type

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Freddy Boulton <alfonsoboulton@gmail.com>
2024-06-06 13:16:14 +01:00

40 lines
809 B
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Client</title>
<script type="module">
import { Client } from "./dist/index.js";
console.log(Client);
const client = await Client.connect("pngwn/chatinterface_streaming_echo");
async function run(message, n) {
// console.log(client);
const req = client.submit("/chat", {
message
});
console.log("start");
for await (const c of req) {
if (c.type === "data") {
console.log(`${n}: ${c.data[0]}`);
}
}
console.log("end");
return "hi";
}
run("My name is frank", 1);
run("Hello there", 2);
console.log("boo");
</script>
</head>
<body>
<div id="app"></div>
</body>
</html>