diff --git a/extensions/elevenlabs_tts/script.py b/extensions/elevenlabs_tts/script.py index cee64c06..2e8b184f 100644 --- a/extensions/elevenlabs_tts/script.py +++ b/extensions/elevenlabs_tts/script.py @@ -1,13 +1,11 @@ +import re from pathlib import Path import gradio as gr +import modules.shared as shared from elevenlabslib import ElevenLabsUser from elevenlabslib.helpers import save_bytes_to_path -import re - -import modules.shared as shared - params = { 'activate': True, 'api_key': '12345', @@ -54,7 +52,6 @@ def refresh_voices(): return def remove_surrounded_chars(string): - # regexp is way faster than repeated string concatenation! # this expression matches to 'as few symbols as possible (0 upwards) between any asterisks' OR # 'as few symbols as possible (0 upwards) between an asterisk and the end of the string' return re.sub('\*[^\*]*?(\*|$)','',string) @@ -113,4 +110,4 @@ def ui(): voice.change(lambda x: params.update({'selected_voice': x}), voice, None) api_key.change(lambda x: params.update({'api_key': x}), api_key, None) connect.click(check_valid_api, [], connection_status) - connect.click(refresh_voices, [], voice) + connect.click(refresh_voices, [], voice) \ No newline at end of file diff --git a/extensions/sd_api_pictures/script.py b/extensions/sd_api_pictures/script.py index 03d3c784..1f6ba2d2 100644 --- a/extensions/sd_api_pictures/script.py +++ b/extensions/sd_api_pictures/script.py @@ -4,13 +4,12 @@ import re from pathlib import Path import gradio as gr +import modules.chat as chat +import modules.shared as shared import requests import torch from PIL import Image -import modules.chat as chat -import modules.shared as shared - torch._C._jit_set_profiling_mode(False) # parameters which can be customized in settings.json of webui @@ -32,7 +31,6 @@ picture_response = False # specifies if the next model response should appear as pic_id = 0 def remove_surrounded_chars(string): - # regexp is way faster than repeated string concatenation! # this expression matches to 'as few symbols as possible (0 upwards) between any asterisks' OR # 'as few symbols as possible (0 upwards) between an asterisk and the end of the string' return re.sub('\*[^\*]*?(\*|$)','',string) @@ -186,4 +184,4 @@ def ui(): force_btn.click(force_pic) generate_now_btn.click(force_pic) - generate_now_btn.click(eval('chat.cai_chatbot_wrapper'), shared.input_params, shared.gradio['display'], show_progress=shared.args.no_stream) + generate_now_btn.click(eval('chat.cai_chatbot_wrapper'), shared.input_params, shared.gradio['display'], show_progress=shared.args.no_stream) \ No newline at end of file diff --git a/extensions/send_pictures/script.py b/extensions/send_pictures/script.py index 05ceed8b..46393e6c 100644 --- a/extensions/send_pictures/script.py +++ b/extensions/send_pictures/script.py @@ -2,12 +2,11 @@ import base64 from io import BytesIO import gradio as gr -import torch -from transformers import BlipForConditionalGeneration, BlipProcessor -from PIL import Image - import modules.chat as chat import modules.shared as shared +import torch +from PIL import Image +from transformers import BlipForConditionalGeneration, BlipProcessor # If 'state' is True, will hijack the next chat generation with # custom input text given by 'value' in the format [text, visible_text] @@ -54,4 +53,4 @@ def ui(): picture_select.upload(eval(function_call), shared.input_params, shared.gradio['display'], show_progress=shared.args.no_stream) # Clear the picture from the upload field - picture_select.upload(lambda : None, [], [picture_select], show_progress=False) + picture_select.upload(lambda : None, [], [picture_select], show_progress=False) \ No newline at end of file diff --git a/extensions/silero_tts/script.py b/extensions/silero_tts/script.py index 447c7033..a81a5da1 100644 --- a/extensions/silero_tts/script.py +++ b/extensions/silero_tts/script.py @@ -1,12 +1,11 @@ +import re import time from pathlib import Path import gradio as gr -import torch -import re - import modules.chat as chat import modules.shared as shared +import torch torch._C._jit_set_profiling_mode(False) @@ -47,7 +46,6 @@ def load_model(): model = load_model() def remove_surrounded_chars(string): - # regexp is way faster than repeated string concatenation! # this expression matches to 'as few symbols as possible (0 upwards) between any asterisks' OR # 'as few symbols as possible (0 upwards) between an asterisk and the end of the string' return re.sub('\*[^\*]*?(\*|$)','',string) @@ -163,4 +161,4 @@ def ui(): autoplay.change(lambda x: params.update({"autoplay": x}), autoplay, None) voice.change(lambda x: params.update({"speaker": x}), voice, None) v_pitch.change(lambda x: params.update({"voice_pitch": x}), v_pitch, None) - v_speed.change(lambda x: params.update({"voice_speed": x}), v_speed, None) + v_speed.change(lambda x: params.update({"voice_speed": x}), v_speed, None) \ No newline at end of file