mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-23 00:18:20 +01:00
Clean method to prevent gradio from phoning home
This commit is contained in:
parent
8275989f03
commit
c58c1d89bd
14
server.py
14
server.py
@ -1,10 +1,21 @@
|
|||||||
import os
|
import os
|
||||||
|
import requests
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
os.environ['GRADIO_ANALYTICS_ENABLED'] = 'False'
|
os.environ['GRADIO_ANALYTICS_ENABLED'] = 'False'
|
||||||
os.environ['BITSANDBYTES_NOWELCOME'] = '1'
|
os.environ['BITSANDBYTES_NOWELCOME'] = '1'
|
||||||
warnings.filterwarnings('ignore', category=UserWarning, message='TypedStorage is deprecated')
|
warnings.filterwarnings('ignore', category=UserWarning, message='TypedStorage is deprecated')
|
||||||
#from modules import dirty_patch_gradio
|
|
||||||
|
# This is a hack to prevent Gradio from phoning home when it gets imported
|
||||||
|
def my_get(url, **kwargs):
|
||||||
|
print('Gradio HTTP request redirected to localhost :)')
|
||||||
|
kwargs.setdefault('allow_redirects', True)
|
||||||
|
return requests.api.request('get', 'http://127.0.0.1/', **kwargs)
|
||||||
|
|
||||||
|
original_get = requests.get
|
||||||
|
requests.get = my_get
|
||||||
|
import gradio as gr
|
||||||
|
requests.get = original_get
|
||||||
|
|
||||||
import importlib
|
import importlib
|
||||||
import io
|
import io
|
||||||
@ -19,7 +30,6 @@ import zipfile
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import gradio as gr
|
|
||||||
import psutil
|
import psutil
|
||||||
import torch
|
import torch
|
||||||
import yaml
|
import yaml
|
||||||
|
Loading…
Reference in New Issue
Block a user