mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-26 01:30:20 +01:00
Monkey patch gradio to prevent it from calling home
This commit is contained in:
parent
6a810b16b2
commit
00186f76f4
13
modules/monkey_patch_gradio.py
Normal file
13
modules/monkey_patch_gradio.py
Normal file
@ -0,0 +1,13 @@
|
||||
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...')
|
||||
with open(file_path, 'w') as f:
|
||||
f.write(new_contents)
|
@ -4,6 +4,7 @@ import warnings
|
||||
os.environ['GRADIO_ANALYTICS_ENABLED'] = 'False'
|
||||
os.environ['BITSANDBYTES_NOWELCOME'] = '1'
|
||||
warnings.filterwarnings('ignore', category=UserWarning, message='TypedStorage is deprecated')
|
||||
from modules import monkey_patch_gradio
|
||||
|
||||
import importlib
|
||||
import io
|
||||
|
Loading…
Reference in New Issue
Block a user