openfree commited on
Commit
f612a8c
ยท
verified ยท
1 Parent(s): f3ad762

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -111,11 +111,14 @@ def generate_design_image(prompt, seed=42, randomize_seed=True, width=1024, heig
111
 
112
  # ์ž…๋ ฅ ํ…์ŠคํŠธ ํด๋ฆฐ์ง• ์ ์šฉ
113
  prompt = clean_input_text(prompt)
114
- # ๋””๋ฒ„๊น…: ์˜ˆ์ƒ์น˜ ๋ชปํ•œ ๋ฌธ์ž ๋กœ๊ทธ ์ถœ๋ ฅ (ํ•„์š” ์‹œ ํ™œ์„ฑํ™”)
115
- # log_unexpected_characters(prompt)
 
 
116
 
117
  if contains_korean(prompt):
118
- translation = translator(prompt)
 
119
  prompt = translation[0]['translation_text']
120
  translated = True
121
 
@@ -135,6 +138,7 @@ def generate_design_image(prompt, seed=42, randomize_seed=True, width=1024, heig
135
 
136
  return image
137
 
 
138
  ##############################################################################
139
  # ๋กœ๊น… ์„ค์ •
140
  ##############################################################################
 
111
 
112
  # ์ž…๋ ฅ ํ…์ŠคํŠธ ํด๋ฆฐ์ง• ์ ์šฉ
113
  prompt = clean_input_text(prompt)
114
+
115
+ # ์‚ฌ์ „ ์ฒ˜๋ฆฌ: ์ž…๋ ฅ ํ…์ŠคํŠธ๊ฐ€ ๋„ˆ๋ฌด ๊ธธ๋ฉด ๋ฏธ๋ฆฌ ์ž๋ฅด๊ธฐ (์˜ˆ: 1000์ž ์ด์ƒ์ด๋ฉด 1000์ž๋กœ ์ž˜๋ผ๋ƒ„)
116
+ if len(prompt) > 1000:
117
+ prompt = prompt[:1000]
118
 
119
  if contains_korean(prompt):
120
+ # ๋ฒˆ์—ญ ํ˜ธ์ถœ ์‹œ max_length์™€ truncation ์˜ต์…˜์„ ์ถ”๊ฐ€ํ•˜์—ฌ ๊ธธ์ด ์ดˆ๊ณผ ๋ฌธ์ œ๋ฅผ ๋ฐฉ์ง€
121
+ translation = translator(prompt, max_length=400, truncation=True)
122
  prompt = translation[0]['translation_text']
123
  translated = True
124
 
 
138
 
139
  return image
140
 
141
+
142
  ##############################################################################
143
  # ๋กœ๊น… ์„ค์ •
144
  ##############################################################################