-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change client submit API to be an AsyncIterable and support more plat…
…forms (#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>
- Loading branch information
1 parent
6447dfa
commit 9d2d605
Showing
27 changed files
with
589 additions
and
331 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
"@gradio/app": patch | ||
"@gradio/client": patch | ||
"@gradio/file": patch | ||
"@gradio/spaces-test": patch | ||
"gradio": patch | ||
--- | ||
|
||
fix:Change client submit API to be an AsyncIterable and support more platforms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<!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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.