Skip to content

Commit

Permalink
reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
thijsi123 committed Feb 2, 2024
1 parent 0a8a36f commit a2424a6
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 5 deletions.
15 changes: 15 additions & 0 deletions .idea/character-factory.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions app/oobabooga - webui.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

folder_path = "models" # Base directory for models


def load_model(model_name, use_safetensors=False, use_local=False):
global sd

Expand All @@ -29,7 +30,8 @@ def load_model(model_name, use_safetensors=False, use_local=False):
sd = StableDiffusionPipeline.from_single_file(model_path, torch_dtype=torch.float16)
else:
print(f"Loading {model_name} from Hugging Face with safetensors={use_safetensors}.")
sd = StableDiffusionPipeline.from_pretrained(model_name, use_safetensors=use_safetensors, torch_dtype=torch.float16)
sd = StableDiffusionPipeline.from_pretrained(model_name, use_safetensors=use_safetensors,
torch_dtype=torch.float16)

if torch.cuda.is_available():
sd.to("cuda")
Expand All @@ -41,6 +43,7 @@ def load_model(model_name, use_safetensors=False, use_local=False):
# For a local .safetensors model
load_model("oof.safetensors", use_safetensors=True, use_local=True)


def process_url(url):
global global_url
global_url = url.rstrip("/") + "/v1/completions" # Append '/v1/completions' to the URL
Expand Down Expand Up @@ -735,7 +738,7 @@ def generate_character_avatar(
input_none(avatar_prompt)
or send_message(
example_dialogue
+ "\n<|user|> create a prompt that lists the appearance " #create a prompt that lists the appearance characteristics of a character whose summary is Gender: male, name=gabe. Topic: anime
+ "\n<|user|> create a prompt that lists the appearance " # create a prompt that lists the appearance characteristics of a character whose summary is Gender: male, name=gabe. Topic: anime
+ "characteristics of a character whose summary is "
+ f"Gender: {gender}"
+ f"{character_summary}. Topic: {topic}</s>\n<|assistant|> "
Expand Down Expand Up @@ -866,6 +869,7 @@ def export_as_json(
# Global variable to store the path of the processed image
processed_image_path = None


def export_character_card(name, summary, personality, scenario, greeting_message, example_messages):
global processed_image_path # Access the global variable

Expand Down Expand Up @@ -900,6 +904,7 @@ def export_character_card(name, summary, personality, scenario, greeting_message
character.export_neutral_card_file(card_path)
return Image.open(card_path)


with gr.Blocks() as webui:
gr.Markdown("# Character Factory WebUI")
gr.Markdown("## OOBABOOGA MODE")
Expand Down Expand Up @@ -1160,6 +1165,3 @@ def handle_example_messages_button_click(
safety_checker_sd = sd.safety_checker

webui.launch(debug=True)



0 comments on commit a2424a6

Please sign in to comment.