Update app.py
Browse files
app.py
CHANGED
@@ -24,14 +24,14 @@ def enable_lora(lora_add, basemodel):
|
|
24 |
print(f"[-] Determining model: LoRA {'enabled' if lora_add else 'disabled'}, base model: {basemodel}")
|
25 |
return basemodel if not lora_add else lora_add
|
26 |
|
27 |
-
def generate_character_description(character_prompt
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
33 |
try:
|
34 |
-
|
35 |
result = qwen_client.predict(
|
36 |
message=character_prompt,
|
37 |
param_2=system_message,
|
@@ -40,14 +40,7 @@ def generate_character_description(character_prompt):
|
|
40 |
param_5=0.95,
|
41 |
api_name="/chat"
|
42 |
)
|
43 |
-
|
44 |
-
message=character_prompt,
|
45 |
-
system_message=system_message,
|
46 |
-
max_tokens=512,
|
47 |
-
temperature=0.7,
|
48 |
-
top_p=0.95,
|
49 |
-
api_name="/chat"
|
50 |
-
)'''
|
51 |
return result
|
52 |
except Exception as e:
|
53 |
return f"Error generating description: {str(e)}"
|
@@ -73,7 +66,7 @@ async def generate_image(prompt, model, lora_word, width, height, scales, steps,
|
|
73 |
# Function to upscale image
|
74 |
def get_upscale_finegrain(prompt, img_path, upscale_factor):
|
75 |
try:
|
76 |
-
print(f"[-]
|
77 |
client = Client("finegrain/finegrain-image-enhancer", hf_token=HF_TOKEN_UPSCALER)
|
78 |
result = client.predict(
|
79 |
input_image=handle_file(img_path),
|
|
|
24 |
print(f"[-] Determining model: LoRA {'enabled' if lora_add else 'disabled'}, base model: {basemodel}")
|
25 |
return basemodel if not lora_add else lora_add
|
26 |
|
27 |
+
def generate_character_description(character_prompt, system_message = """
|
28 |
+
You are a character description generator. Create detailed, vivid descriptions
|
29 |
+
of characters including their physical appearance, personality, and notable features. Keep the
|
30 |
+
description focused on visual elements that could be used for image generation.
|
31 |
+
"""
|
32 |
+
):
|
33 |
+
"""Generate detailed character description using K00B404/HugChatWrap space"""
|
34 |
try:
|
|
|
35 |
result = qwen_client.predict(
|
36 |
message=character_prompt,
|
37 |
param_2=system_message,
|
|
|
40 |
param_5=0.95,
|
41 |
api_name="/chat"
|
42 |
)
|
43 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
return result
|
45 |
except Exception as e:
|
46 |
return f"Error generating description: {str(e)}"
|
|
|
66 |
# Function to upscale image
|
67 |
def get_upscale_finegrain(prompt, img_path, upscale_factor):
|
68 |
try:
|
69 |
+
print(f"[-] Processing with Factor {upscale_factor} for Image {img_path}")
|
70 |
client = Client("finegrain/finegrain-image-enhancer", hf_token=HF_TOKEN_UPSCALER)
|
71 |
result = client.predict(
|
72 |
input_image=handle_file(img_path),
|