mirror of
https://github.com/ParisNeo/lollms.git
synced 2024-12-18 20:27:58 +00:00
upgraded oersinality and tti
This commit is contained in:
parent
40256aee84
commit
98d064608c
@ -1010,8 +1010,7 @@ class AIPersonality:
|
||||
self.audio_files.append(path)
|
||||
if process:
|
||||
self.new_message("")
|
||||
self.info(f"Transcribing ... ")
|
||||
self.step_start("Transcribing ... ")
|
||||
self.ShowBlockingMessage(f"Transcribing ... ")
|
||||
if self.app.stt is None:
|
||||
self.InfoMessage("No STT service is up.\nPlease configure your default STT service in the settings page.")
|
||||
return
|
||||
@ -1022,7 +1021,6 @@ class AIPersonality:
|
||||
|
||||
self.info(f"File saved to {transcription_fn}")
|
||||
self.full(text)
|
||||
self.step_end("Transcribing ... ")
|
||||
elif path.suffix in [".png",".jpg",".jpeg",".gif",".bmp",".svg",".webp"]:
|
||||
self.image_files.append(path)
|
||||
if process:
|
||||
@ -2333,10 +2331,14 @@ class APScript(StateMachine):
|
||||
self.step_start(f" Summary of {doc_name} - Processing chunk : {i+1}/{len(chunks)}")
|
||||
summary = f"{answer_start}"+ self.fast_gen(
|
||||
"\n".join([
|
||||
f"{start_header_id_template}Document_chunk{end_header_id_template}{doc_name}:",
|
||||
f"{start_header_id_template}Previous_chunks_summary{end_header_id_template}",
|
||||
f"{summary}",
|
||||
f"{start_header_id_template}Current_chunk{end_header_id_template}",
|
||||
f"{chunk}",
|
||||
f"{start_header_id_template}{system_message_template}{end_header_id_template}{summary_instruction}",
|
||||
f"Summerize the current chunk and fuse it with previous chunk summary ion order to keep the required informations.",
|
||||
f"The summary needs to keep all relevant information.",
|
||||
f"Be precise and do not invent information that does not exist in the previous summary or the current chunk.",
|
||||
f"Answer directly with the summary with no extra comments.",
|
||||
f"{start_header_id_template}summary{end_header_id_template}",
|
||||
f"{answer_start}"
|
||||
|
@ -52,11 +52,16 @@ class LollmsDalle(LollmsTTI):
|
||||
self,
|
||||
positive_prompt,
|
||||
negative_prompt,
|
||||
sampler_name="Euler",
|
||||
seed=-1,
|
||||
scale=7.5,
|
||||
steps=20,
|
||||
img2img_denoising_strength=0.9,
|
||||
width=512,
|
||||
height=512,
|
||||
images = [],
|
||||
generation_engine=None,
|
||||
output_path = None
|
||||
restore_faces=True,
|
||||
output_path=None,
|
||||
generation_engine=None
|
||||
):
|
||||
if output_path is None:
|
||||
output_path = self.output_path
|
||||
@ -126,33 +131,18 @@ class LollmsDalle(LollmsTTI):
|
||||
def paint_from_images(self, positive_prompt: str, images: List[str], negative_prompt: str = "") -> List[Dict[str, str]]:
|
||||
if output_path is None:
|
||||
output_path = self.output_path
|
||||
if generation_engine is None:
|
||||
generation_engine = self.generation_engine
|
||||
if not PackageManager.check_package_installed("openai"):
|
||||
PackageManager.install_package("openai")
|
||||
import openai
|
||||
openai.api_key = self.key
|
||||
if generation_engine=="dall-e-2":
|
||||
supported_resolutions = [
|
||||
[512, 512],
|
||||
[1024, 1024],
|
||||
]
|
||||
# Find the closest resolution
|
||||
closest_resolution = min(supported_resolutions, key=lambda res: abs(res[0] - width) + abs(res[1] - height))
|
||||
|
||||
else:
|
||||
supported_resolutions = [
|
||||
[1024, 1024],
|
||||
[1024, 1792],
|
||||
[1792, 1024]
|
||||
]
|
||||
# Find the closest resolution
|
||||
if width>height:
|
||||
closest_resolution = [1792, 1024]
|
||||
elif width<height:
|
||||
closest_resolution = [1024, 1792]
|
||||
else:
|
||||
closest_resolution = [1024, 1024]
|
||||
generation_engine="dall-e-2"
|
||||
supported_resolutions = [
|
||||
[512, 512],
|
||||
[1024, 1024],
|
||||
]
|
||||
# Find the closest resolution
|
||||
closest_resolution = min(supported_resolutions, key=lambda res: abs(res[0] - width) + abs(res[1] - height))
|
||||
|
||||
|
||||
|
||||
# Update the width and height
|
||||
|
@ -150,7 +150,6 @@ class LollmsFooocus(LollmsTTI):
|
||||
self,
|
||||
positive_prompt,
|
||||
negative_prompt,
|
||||
files=[],
|
||||
sampler_name="Euler",
|
||||
seed=-1,
|
||||
scale=7.5,
|
||||
|
@ -50,11 +50,15 @@ class LollmsMidjourney(LollmsTTI):
|
||||
self,
|
||||
positive_prompt,
|
||||
negative_prompt,
|
||||
sampler_name="Euler",
|
||||
seed=-1,
|
||||
scale=7.5,
|
||||
steps=20,
|
||||
img2img_denoising_strength=0.9,
|
||||
width=512,
|
||||
height=512,
|
||||
images = [],
|
||||
generation_engine=None,
|
||||
output_path = None
|
||||
restore_faces=True,
|
||||
output_path=None
|
||||
):
|
||||
if output_path is None:
|
||||
output_path = self.output_path
|
||||
|
Loading…
Reference in New Issue
Block a user