disable telemetry/what-have-you if not requesting a public Gradio URL

This commit is contained in:
mrq 2023-02-07 21:44:16 +00:00
parent 479f30c808
commit f03b6b8d97

15
app.py
View File

@ -10,6 +10,7 @@ import torch
import torchaudio import torchaudio
import music_tag import music_tag
import gradio as gr import gradio as gr
import gradio.utils
from datetime import datetime from datetime import datetime
@ -497,7 +498,6 @@ def main():
if __name__ == "__main__": if __name__ == "__main__":
default_arguments = { default_arguments = {
'share': False, 'share': False,
'check-for-updates': False, 'check-for-updates': False,
@ -522,6 +522,19 @@ if __name__ == "__main__":
parser.add_argument("--concurrency-count", type=int, default=default_arguments['concurrency-count'], help="How many Gradio events to process at once") parser.add_argument("--concurrency-count", type=int, default=default_arguments['concurrency-count'], help="How many Gradio events to process at once")
args = parser.parse_args() args = parser.parse_args()
if not args.share:
def noop(function, return_value=None):
def wrapped(*args, **kwargs):
return return_value
return wrapped
gradio.utils.version_check = noop(gradio.utils.version_check)
gradio.utils.initiated_analytics = noop(gradio.utils.initiated_analytics)
gradio.utils.launch_analytics = noop(gradio.utils.launch_analytics)
gradio.utils.integration_analytics = noop(gradio.utils.integration_analytics)
gradio.utils.error_analytics = noop(gradio.utils.error_analytics)
gradio.utils.log_feature_analytics = noop(gradio.utils.log_feature_analytics)
gradio.utils.get_local_ip_address = noop(gradio.utils.get_local_ip_address, 'localhost')
print("Initializating TorToiSe...") print("Initializating TorToiSe...")
tts = TextToSpeech( tts = TextToSpeech(
minor_optimizations=not args.low_vram, minor_optimizations=not args.low_vram,