Minor changes

This commit is contained in:
oobabooga 2023-03-22 15:55:03 -03:00 committed by GitHub
parent 5389fce8e1
commit 104212529f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 21 deletions

View file

@ -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)