fix static paths and demo launch

This commit is contained in:
Ali 2021-12-26 22:30:19 -08:00
parent 18a75e409c
commit 82b377483c
2 changed files with 9 additions and 3 deletions

View File

@ -1 +1,7 @@
__webpack_public_path__ = window.gradio_mode == "app" ? "/" : "https://gradio.s3-us-west-2.amazonaws.com/" + process.env.REACT_APP_VERSION + "/";
if (window.gradio_mode === "app") {
__webpack_public_path__ = "/";
} else if (window.gradio_mode === "website") {
__webpack_public_path__ = "gradio_static/"
} else {
__webpack_public_path__ = "https://gradio.s3-us-west-2.amazonaws.com/" + process.env.REACT_APP_VERSION + "/";
}

View File

@ -23,8 +23,8 @@ for demo_name, port in demo_port_sets:
with open(demo_file, 'r') as file:
filedata = file.read()
filedata = filedata.replace(
f'if __name__ == "__main__":',
f'if __name__ == "__main__":\n iface.server_port={port}')
f'iface.launch()',
f'iface.launch(server_port={port})')
with open(demo_file, 'w') as file:
file.write(filedata)
demo_thread = threading.Thread(target=launch_demo, args=(demo_folder,))