Rename a file

This commit is contained in:
oobabooga 2023-04-18 01:38:33 -03:00 committed by GitHub
parent b069bb1f2e
commit 36f7c022f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 1 deletions

View file

@ -0,0 +1,18 @@
import importlib
import pathlib
file_path = pathlib.Path(importlib.util.find_spec("gradio").submodule_search_locations[0]) / "strings.py"
with open(file_path, 'r') as f:
contents = f.read()
new_contents = contents.replace('threading.Thread(target=get_updated_messaging, args=(en,)).start()', '')
if contents != new_contents:
print('Patching gradio to prevent it from calling home every time it gets imported...')
try:
# This is dirty but harmless.
with open(file_path, 'w') as f:
f.write(new_contents)
except:
pass