Extension install improvements

This commit is contained in:
oobabooga 2023-09-25 20:27:06 -07:00
parent 7f1460af29
commit 814520fed1
2 changed files with 2 additions and 5 deletions

View File

@ -34,8 +34,7 @@ def clone_or_pull_repository(github_url):
yield f"Cloning {github_url}..." yield f"Cloning {github_url}..."
clone_output = subprocess.check_output(["git", "clone", github_url, repo_path], stderr=subprocess.STDOUT) clone_output = subprocess.check_output(["git", "clone", github_url, repo_path], stderr=subprocess.STDOUT)
new_extensions.add(repo_name) new_extensions.add(repo_name)
logger.info(f"The extension {repo_name} has been downloaded. Please close the the web UI and launch it again to be able to load it.") yield(f"The extension `{repo_name}` has been downloaded.\n\nPlease close the the web UI completely and launch it again to be able to load it.")
yield "Done."
return clone_output.decode() return clone_output.decode()
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
return str(e) return str(e)

View File

@ -25,9 +25,7 @@ def create_ui():
extension_name = gr.Textbox(lines=1, label='Install or update an extension', info='Enter the GitHub URL below and press Enter. For a list of extensions, see: https://github.com/oobabooga/text-generation-webui-extensions ⚠️ WARNING ⚠️ : extensions can execute arbitrary code. Make sure to inspect their source code before activating them.') extension_name = gr.Textbox(lines=1, label='Install or update an extension', info='Enter the GitHub URL below and press Enter. For a list of extensions, see: https://github.com/oobabooga/text-generation-webui-extensions ⚠️ WARNING ⚠️ : extensions can execute arbitrary code. Make sure to inspect their source code before activating them.')
extension_status = gr.Markdown() extension_status = gr.Markdown()
extension_name.submit( extension_name.submit(clone_or_pull_repository, extension_name, extension_status, show_progress=False)
clone_or_pull_repository, extension_name, extension_status, show_progress=False).then(
lambda: gr.update(choices=utils.get_available_extensions(), value=shared.args.extensions), None, gradio('extensions_menu'))
# Reset interface event # Reset interface event
shared.gradio['reset_interface'].click( shared.gradio['reset_interface'].click(