openfree commited on
Commit
52df737
ยท
verified ยท
1 Parent(s): 40c2181

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -10
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
- lora_path = hf_hub_download(
97
- repo_id="openfree/myt-flux-fantasy",
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 Canvas</h1>
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
  """)