Fix the Wasm worker to initialize the app directories (#6887)

* Fix the Wasm worker to initialize the app directories

* add changeset

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
Yuichiro Tachibana (Tsuchiya) 2023-12-27 17:27:36 +09:00 committed by GitHub
parent 31c23166f0
commit 8333db83ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View File

@ -0,0 +1,6 @@
---
"@gradio/wasm": patch
"gradio": patch
---
feat:Fix the Wasm worker to initialize the app directories

View File

@ -187,6 +187,13 @@ async function initializeApp(
options: InMessageInitApp["data"],
updateProgress: (log: string) => void
): Promise<void> {
const appHomeDir = getAppHomeDir(appId);
console.debug("Creating a home directory for the app.", {
appId,
appHomeDir
});
pyodide.FS.mkdir(appHomeDir);
console.debug("Mounting files.", options.files);
updateProgress("Mounting files");
await Promise.all(
@ -249,6 +256,8 @@ function setupMessageHandler(receiver: MessageTransceiver): void {
// This multi-app mechanism was introduced for a SharedWorker, but the same mechanism is used for a DedicatedWorker as well.
const appId = generateRandomString(8);
console.debug("Set up a new app.", { appId });
const updateProgress = (log: string): void => {
const message: OutMessage = {
type: "progress-update",