Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -63,7 +63,8 @@ def translate_to_english(text: str) -> str:
|
|
| 63 |
except Exception as e:
|
| 64 |
print(f"Translation error: {str(e)}")
|
| 65 |
return text
|
| 66 |
-
|
|
|
|
| 67 |
# FLUX ํ์ดํ๋ผ์ธ ์ด๊ธฐํ ๋ถ๋ถ ์์
|
| 68 |
print("Initializing FLUX pipeline...")
|
| 69 |
try:
|
|
@@ -90,23 +91,21 @@ except Exception as e:
|
|
| 90 |
print(f"Error initializing FLUX pipeline: {str(e)}")
|
| 91 |
raise
|
| 92 |
|
| 93 |
-
# LoRA ๊ฐ์ค์น ๋ก๋ ๋ถ๋ถ
|
| 94 |
print("Loading LoRA weights...")
|
| 95 |
try:
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
filename="myt-flux-fantasy.safetensors",
|
| 99 |
-
use_auth_token=HF_TOKEN
|
| 100 |
-
)
|
| 101 |
-
print(f"LoRA weights downloaded to: {lora_path}")
|
| 102 |
|
|
|
|
| 103 |
pipe.load_lora_weights(lora_path)
|
| 104 |
pipe.fuse_lora(lora_scale=0.125)
|
| 105 |
print("LoRA weights loaded and fused successfully")
|
| 106 |
|
| 107 |
except Exception as e:
|
| 108 |
print(f"Error loading LoRA weights: {str(e)}")
|
| 109 |
-
raise ValueError("Failed to load LoRA weights")
|
|
|
|
| 110 |
|
| 111 |
# generate_image ํจ์ ์์
|
| 112 |
@spaces.GPU(duration=60)
|
|
@@ -299,7 +298,7 @@ footer {display: none}
|
|
| 299 |
with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
| 300 |
gr.HTML("""
|
| 301 |
<div class="main-title">
|
| 302 |
-
<h1>๐จ Webtoon
|
| 303 |
<p>Generate webtoon-style images and add text with various styles and positions.</p>
|
| 304 |
</div>
|
| 305 |
""")
|
|
|
|
| 63 |
except Exception as e:
|
| 64 |
print(f"Translation error: {str(e)}")
|
| 65 |
return text
|
| 66 |
+
|
| 67 |
+
|
| 68 |
# FLUX ํ์ดํ๋ผ์ธ ์ด๊ธฐํ ๋ถ๋ถ ์์
|
| 69 |
print("Initializing FLUX pipeline...")
|
| 70 |
try:
|
|
|
|
| 91 |
print(f"Error initializing FLUX pipeline: {str(e)}")
|
| 92 |
raise
|
| 93 |
|
| 94 |
+
# LoRA ๊ฐ์ค์น ๋ก๋ ๋ถ๋ถ ์์
|
| 95 |
print("Loading LoRA weights...")
|
| 96 |
try:
|
| 97 |
+
# ๋ก์ปฌ LoRA ํ์ผ ๊ฒฝ๋ก ์ง์
|
| 98 |
+
lora_path = "myt-flux-fantasy.safetensors" # ํ์ฌ ๋๋ ํ ๋ฆฌ์ ํ์ผ ์ง์ ์ฌ์ฉ
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
|
| 100 |
+
print(f"Loading LoRA weights from local file: {lora_path}")
|
| 101 |
pipe.load_lora_weights(lora_path)
|
| 102 |
pipe.fuse_lora(lora_scale=0.125)
|
| 103 |
print("LoRA weights loaded and fused successfully")
|
| 104 |
|
| 105 |
except Exception as e:
|
| 106 |
print(f"Error loading LoRA weights: {str(e)}")
|
| 107 |
+
raise ValueError(f"Failed to load LoRA weights from {lora_path}: {str(e)}")
|
| 108 |
+
|
| 109 |
|
| 110 |
# generate_image ํจ์ ์์
|
| 111 |
@spaces.GPU(duration=60)
|
|
|
|
| 298 |
with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
| 299 |
gr.HTML("""
|
| 300 |
<div class="main-title">
|
| 301 |
+
<h1>๐จ Webtoon Studio</h1>
|
| 302 |
<p>Generate webtoon-style images and add text with various styles and positions.</p>
|
| 303 |
</div>
|
| 304 |
""")
|