Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -30,7 +30,6 @@ except Exception as e:
|
|
30 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
31 |
|
32 |
dtype = torch.bfloat16 if device == "cuda" else torch.float32
|
33 |
-
|
34 |
print(f"Using device: {device}, dtype: {dtype}")
|
35 |
|
36 |
##############################################################################
|
@@ -42,18 +41,15 @@ try:
|
|
42 |
model="Helsinki-NLP/opus-mt-ko-en",
|
43 |
device=0 if device == "cuda" else -1
|
44 |
)
|
45 |
-
|
46 |
pipe = DiffusionPipeline.from_pretrained(
|
47 |
"black-forest-labs/FLUX.1-schnell",
|
48 |
torch_dtype=dtype
|
49 |
).to(device)
|
50 |
-
|
51 |
print("Models loaded successfully")
|
52 |
except Exception as e:
|
53 |
print(f"Error loading models: {e}")
|
54 |
def dummy_translator(text):
|
55 |
return [{'translation_text': text}]
|
56 |
-
|
57 |
class DummyPipe:
|
58 |
def __call__(self, **kwargs):
|
59 |
from PIL import Image
|
@@ -63,7 +59,6 @@ except Exception as e:
|
|
63 |
def __init__(self, img):
|
64 |
self.images = [img]
|
65 |
return DummyResult(dummy_img)
|
66 |
-
|
67 |
translator = dummy_translator
|
68 |
pipe = DummyPipe()
|
69 |
|
@@ -102,25 +97,19 @@ def log_unexpected_characters(text):
|
|
102 |
def generate_design_image(prompt, seed=42, randomize_seed=True, width=1024, height=1024, num_inference_steps=4):
|
103 |
original_prompt = prompt
|
104 |
translated = False
|
105 |
-
|
106 |
# Clean the input text
|
107 |
prompt = clean_input_text(prompt)
|
108 |
-
|
109 |
# Pre-process: if input is too long, trim to 1000 characters
|
110 |
if len(prompt) > 1000:
|
111 |
prompt = prompt[:1000]
|
112 |
-
|
113 |
if contains_korean(prompt):
|
114 |
# When calling translation, add max_length and truncation options to avoid length issues
|
115 |
translation = translator(prompt, max_length=400, truncation=True)
|
116 |
prompt = translation[0]['translation_text']
|
117 |
translated = True
|
118 |
-
|
119 |
if randomize_seed:
|
120 |
seed = random.randint(0, MAX_SEED)
|
121 |
-
|
122 |
generator = torch.Generator(device=device).manual_seed(seed)
|
123 |
-
|
124 |
image = pipe(
|
125 |
prompt=prompt,
|
126 |
width=width,
|
@@ -129,7 +118,6 @@ def generate_design_image(prompt, seed=42, randomize_seed=True, width=1024, heig
|
|
129 |
generator=generator,
|
130 |
guidance_scale=0.0
|
131 |
).images[0]
|
132 |
-
|
133 |
return image
|
134 |
|
135 |
##############################################################################
|
@@ -257,257 +245,6 @@ physical_transformation_categories = {
|
|
257 |
"๊ด๋ ๋ณํ"
|
258 |
],
|
259 |
"์๋ฆฌ์ ์ง๋ ํจ๊ณผ": [
|
260 |
-
"์๋ฆฌ ๋ฐ์/์๋ฉธ", "์๋ฆฌ ๋๋ฎ์ด ๋ณํ", "์๋ฆฌ ํฌ๊ธฐ ๋ณํ", "์์ ๋ณํ",
|
261 |
-
"๊ณต๋ช
/๋ฐ๊ณต๋ช
", "์ํฅ ์ง๋", "์ด์ํ/์ ์ํ ๋ฐ์", "์ํฅ ์ง์ค/๋ถ์ฐ",
|
262 |
-
"์ํฅ ๋ฐ์ฌ/ํก์", "์ํฅ ๋ํ๋ฌ ํจ๊ณผ", "์ํ ๊ฐ์ญ", "์ํฅ ๊ณต์ง",
|
263 |
-
"์ง๋ ํจํด ๋ณํ", "ํ์
ํจ๊ณผ", "์ํฅ ํผ๋๋ฐฑ", "์ํฅ ์ฐจํ/์ฆํญ",
|
264 |
-
"์๋ฆฌ ์งํฅ์ฑ", "์ํฅ ์๊ณก", "๋นํธ ์์ฑ", "ํ๋ชจ๋์ค ์์ฑ", "์ฃผํ์ ๋ณ์กฐ",
|
265 |
-
"์ํฅ ์ถฉ๊ฒฉํ", "์ํฅ ํํฐ๋ง"
|
266 |
-
],
|
267 |
-
"์๋ฆฌ์ ์ง๋ ํจ๊ณผ": [
|
268 |
-
"์๋ฆฌ ๋ฐ์/์๋ฉธ",
|
269 |
-
"์ ๋๋ฎ์ด ๋ณํ",
|
270 |
-
"์๋ ๋ณํ",
|
271 |
-
"์์ ๋ณํ",
|
272 |
-
"๊ณต๋ช
/๋ฐ๊ณต๋ช
",
|
273 |
-
"์ํฅ ์ง๋",
|
274 |
-
"์ด์ํ/์ ์ํ ๋ฐ์",
|
275 |
-
"์๋ฆฌ ์ง์ค/๋ถ์ฐ",
|
276 |
-
"์ํฅ ๋ฐ์ฌ/ํก์",
|
277 |
-
"์ํฅ ๋ํ๋ฌ ํจ๊ณผ",
|
278 |
-
"์ํ ๊ฐ์ญ",
|
279 |
-
"์ํฅ ๊ณต์ง",
|
280 |
-
"์ง๋ ํจํด ๋ณํ",
|
281 |
-
"ํ์
ํจ๊ณผ",
|
282 |
-
"์ํฅ ํผ๋๋ฐฑ",
|
283 |
-
"์ํฅ ์ฐจํ/์ฆํญ",
|
284 |
-
"์๋ฆฌ ์งํฅ์ฑ",
|
285 |
-
"์๋ฆฌ ์๊ณก",
|
286 |
-
"๋นํธ ์์ฑ",
|
287 |
-
"๋ฐฐ์ ์์ฑ",
|
288 |
-
"์ฃผํ์ ๋ณ์กฐ",
|
289 |
-
"์ํฅ ์ถฉ๊ฒฉํ",
|
290 |
-
"์ํฅ ํํฐ๋ง"
|
291 |
-
],
|
292 |
-
"์ด ๊ด๋ จ ๋ณํ": [
|
293 |
-
"์จ๋ ์์น/ํ๊ฐ",
|
294 |
-
"์ด ํฝ์ฐฝ/์์ถ",
|
295 |
-
"์ด ์ ๋ฌ/์ฐจ๋จ",
|
296 |
-
"์๋ ฅ ์์น/ํ๊ฐ",
|
297 |
-
"์ด ๋ณํ์ ๋ฐ๋ฅธ ์ํ",
|
298 |
-
"์ํธ๋กํผ ๋ณํ",
|
299 |
-
"์ด์ ๊ธฐ ํจ๊ณผ",
|
300 |
-
"์๊ธฐ์ฅ์ ์ํ ์ด ๋ณํ",
|
301 |
-
"์ํ ๋ณํ ์ค ์ด ์ ์ฅ/๋ฐฉ์ถ",
|
302 |
-
"์ด ์คํธ๋ ์ค ๋ฐ์/ํด์",
|
303 |
-
"๊ธ๊ฒฉํ ์จ๋ ๋ณํ ์ํฅ",
|
304 |
-
"๋ณต์ฌ ๋๊ฐ/๊ฐ์ด",
|
305 |
-
"๋ฐ์ด/ํก์ด",
|
306 |
-
"์ด ๋ถํฌ ๋ณํ",
|
307 |
-
"์ด ๋ฐ์ฌ/ํก์",
|
308 |
-
"๋๊ฐ ์์ถ",
|
309 |
-
"์ด ํ์ฑํ",
|
310 |
-
"์ด ๋ณ์",
|
311 |
-
"์ด ํฝ์ฐฝ ๊ณ์ ๋ณํ",
|
312 |
-
"์ด ์์ ์ฑ ๋ณํ",
|
313 |
-
"๋ด์ด์ฑ/๋ดํ์ฑ",
|
314 |
-
"์๊ฐ ๋ฐ์ด",
|
315 |
-
"์ด์ ํํ/๋ถ๊ท ํ",
|
316 |
-
"์ด์ ๋ณํ",
|
317 |
-
"์ด ๋ถ์ฐ/์ง์ค"
|
318 |
-
],
|
319 |
-
"์ ๊ธฐ ๋ฐ ์๊ธฐ ๋ณํ": [
|
320 |
-
"์์ฑ ์์ฑ/์๋ฉธ",
|
321 |
-
"์ ํ๋ ์ฆ๊ฐ/๊ฐ์",
|
322 |
-
"์ ๊ธฐ์ฅ ์์ฑ/์๋ฉธ",
|
323 |
-
"์๊ธฐ์ฅ ์์ฑ/์๋ฉธ",
|
324 |
-
"์ด์ ๋ ์ํ ์ ํ",
|
325 |
-
"๊ฐ์ ์ ์ฒด ํน์ฑ ๋ณํ",
|
326 |
-
"์์ ์ํ ๋ณํ",
|
327 |
-
"ํ๋ผ์ฆ๋ง ํ์ฑ/์๋ฉธ",
|
328 |
-
"์คํํ ์ ๋ฌ",
|
329 |
-
"๋น์ ์ํ ์ ๊ธฐ ๋ฐ์",
|
330 |
-
"์๋ ฅ์ ์ํ ์ ๊ธฐ ๋ฐ์",
|
331 |
-
"์๊ธฐ์ฅ ๋ด ์ ๋ฅ ๋ณํ",
|
332 |
-
"์ ๊ธฐ ์ ํญ ๋ณํ",
|
333 |
-
"์ ๊ธฐ ์ ๋์ฑ ๋ณํ",
|
334 |
-
"์ ๏ฟฝ๏ฟฝ๊ธฐ ๋ฐ์/๋ฐฉ์ ",
|
335 |
-
"์ ์๊ธฐ ์ ๋",
|
336 |
-
"์ ์๊ธฐํ ๋ฐฉ์ถ/ํก์",
|
337 |
-
"์ ๊ธฐ ์ฉ๋ ๋ณํ",
|
338 |
-
"์๊ธฐ ์ด๋ ฅ ํ์",
|
339 |
-
"์ ๊ธฐ์ ๋ถ๊ทน",
|
340 |
-
"์ ์ ํ๋ฆ ๋ฐฉํฅ ๋ณํ",
|
341 |
-
"์ ๊ธฐ์ ๊ณต๋ช
",
|
342 |
-
"์ ๊ธฐ์ ์ฐจํ/๋
ธ์ถ",
|
343 |
-
"์๊ธฐ ์ฐจํ/๋
ธ์ถ",
|
344 |
-
"์๊ธฐ์ฅ ์ ๋ ฌ"
|
345 |
-
],
|
346 |
-
"ํํ์ ๋ณํ": [
|
347 |
-
"ํ๋ฉด ์ฝํ
๋ณํ",
|
348 |
-
"๋ฌผ์ง ์ฑ๋ถ ๋ณํ",
|
349 |
-
"ํํ ๋ฐ์ ๋ณํ",
|
350 |
-
"์ด๋งค ์์ฉ ์์/์ค๋จ",
|
351 |
-
"๋น์ ์ํ ํํ ๋ฐ์",
|
352 |
-
"์ ๊ธฐ์ ์ํ ํํ ๋ฐ์",
|
353 |
-
"๋จ๋ถ์๋ง ํ์ฑ",
|
354 |
-
"๋ถ์ ์์ค ๊ตฌ์กฐ ๋ณํ",
|
355 |
-
"์์ฒด ๋ชจ๋ฐฉ ํ๋ฉด ๋ณํ",
|
356 |
-
"ํ๊ฒฝ ๋ฐ์ํ ๋ฌผ์ง ๋ณํ",
|
357 |
-
"์ฃผ๊ธฐ์ ํํ ๋ฐ์",
|
358 |
-
"์ฐํ",
|
359 |
-
"ํ์",
|
360 |
-
"๊ณ ๋ถ์ํ",
|
361 |
-
"๋ฌผ ๋ถํด",
|
362 |
-
"ํํฉ",
|
363 |
-
"๋ฐฉ์ฌ์ ์ํฅ",
|
364 |
-
"์ฐ-์ผ๊ธฐ ๋ฐ์",
|
365 |
-
"์คํ ๋ฐ์",
|
366 |
-
"์ด์จํ",
|
367 |
-
"ํํ์ ํก์ฐฉ/ํ์ฐฉ",
|
368 |
-
"์ด๋งค ํจ์จ ๋ณํ",
|
369 |
-
"ํจ์ ํ์ฑ ๋ณํ",
|
370 |
-
"๋ฐ์ ๋ฐ์",
|
371 |
-
"pH ๋ณํ",
|
372 |
-
"ํํ์ ํํ ์ด๋",
|
373 |
-
"๊ฒฐํฉ ํ์ฑ/๋ถํด",
|
374 |
-
"์ฉํด๋ ๋ณํ"
|
375 |
-
],
|
376 |
-
"์๋ฌผํ์ ๋ณํ": [
|
377 |
-
"์ฑ์ฅ/์์ถ",
|
378 |
-
"์ธํฌ ๋ถ์ด/์ฌ๋ฉธ",
|
379 |
-
"์๋ฌผ ๋ฐ๊ด",
|
380 |
-
"์ ์ง๋์ฌ ๋ณํ",
|
381 |
-
"๋ฉด์ญ ๋ฐ์",
|
382 |
-
"ํธ๋ฅด๋ชฌ ๋ถ๋น",
|
383 |
-
"์ ๊ฒฝ ๋ฐ์",
|
384 |
-
"์ ์ ์ ๋ฐํ",
|
385 |
-
"์ ์/์งํ",
|
386 |
-
"์์ฒด๋ฆฌ๋ฌ ๋ณํ",
|
387 |
-
"์ฌ์/์น์ ",
|
388 |
-
"๋
ธํ/์ฑ์",
|
389 |
-
"์์ฒด ๋ชจ๋ฐฉ ๋ณํ",
|
390 |
-
"๋ฐ์ด์คํ๋ฆ ํ์ฑ",
|
391 |
-
"์๋ฌผํ์ ๋ถํด",
|
392 |
-
"ํจ์ ํ์ฑํ/๋นํ์ฑํ",
|
393 |
-
"์๋ฌผํ์ ์ ํธ ์ ๋ฌ",
|
394 |
-
"์คํธ๋ ์ค ๋ฐ์",
|
395 |
-
"์ฒด์จ ์กฐ์ ",
|
396 |
-
"์๋ฌผํ์ ์๊ณ ๋ณํ",
|
397 |
-
"์ธํฌ์ธ ๊ธฐ์ง ๋ณํ",
|
398 |
-
"์์ฒด ์ญํ์ ๋ฐ์",
|
399 |
-
"์ธํฌ ์ด๋์ฑ",
|
400 |
-
"์ธํฌ ๊ทน์ฑ ๋ณํ",
|
401 |
-
"์์ ์ํ ๋ณํ"
|
402 |
-
],
|
403 |
-
"ํ๊ฒฝ ์ํธ์์ฉ": [
|
404 |
-
"์จ๋ ๋ฐ์",
|
405 |
-
"์ต๋ ๋ฐ์",
|
406 |
-
"๊ธฐ์ ๋ฐ์",
|
407 |
-
"์ค๋ ฅ ๋ฐ์",
|
408 |
-
"์๊ธฐ์ฅ ๋ฐ์",
|
409 |
-
"๋น ๋ฐ์",
|
410 |
-
"์๋ฆฌ ๋ฐ์",
|
411 |
-
"ํํ ๋ฌผ์ง ๊ฐ์ง",
|
412 |
-
"๊ธฐ๊ณ์ ์๊ทน ๊ฐ์ง",
|
413 |
-
"์ ๊ธฐ ์๊ทน ๋ฐ์",
|
414 |
-
"๋ฐฉ์ฌ์ ๋ฐ์",
|
415 |
-
"์ง๋ ๊ฐ์ง",
|
416 |
-
"pH ๋ฐ์",
|
417 |
-
"์ฉ๋งค ๋ฐ์",
|
418 |
-
"๊ธฐ์ฒด ๊ตํ",
|
419 |
-
"ํ๊ฒฝ ์ค์ผ ๋ฐ์",
|
420 |
-
"๋ ์จ ๋ฐ์",
|
421 |
-
"๊ณ์ ๋ฐ์",
|
422 |
-
"์ผ์ฃผ๊ธฐ ๋ฐ์",
|
423 |
-
"์ํ๊ณ ์ํธ์์ฉ",
|
424 |
-
"๊ณต์/๊ฒฝ์ ๋ฐ์",
|
425 |
-
"ํฌ์/ํผ์ ๊ด๊ณ",
|
426 |
-
"๊ตฐ์ง ํ์ฑ",
|
427 |
-
"์์ญ ์ค์ ",
|
428 |
-
"์ด์ฃผ/์ ์ฐฉ ํจํด"
|
429 |
-
]
|
430 |
-
}
|
431 |
-
|
432 |
-
# English version
|
433 |
-
physical_transformation_categories_en = {
|
434 |
-
"Sensor Functions": [
|
435 |
-
"Visual sensor/detection", "Auditory sensor/detection", "Tactile sensor/detection", "Taste sensor/detection", "Olfactory sensor/detection",
|
436 |
-
"Temperature sensor/detection", "Humidity sensor/detection", "Pressure sensor/detection", "Acceleration sensor/detection", "Rotational sensor/detection",
|
437 |
-
"Proximity sensor/detection", "Position sensor/detection", "Motion sensor/detection", "Gas sensor/detection", "Infrared sensor/detection",
|
438 |
-
"Ultraviolet sensor/detection", "Radiation sensor/detection", "Magnetic sensor/detection", "Electric field sensor/detection", "Chemical sensor/detection",
|
439 |
-
"Biosignal sensor/detection", "Vibration sensor/detection", "Noise sensor/detection", "Light intensity sensor/detection", "Light wavelength sensor/detection",
|
440 |
-
"Tilt sensor/detection", "pH sensor/detection", "Current sensor/detection", "Voltage sensor/detection", "Image sensor/detection",
|
441 |
-
"Distance sensor/detection", "Depth sensor/detection", "Gravity sensor/detection", "Speed sensor/detection", "Flow sensor/detection",
|
442 |
-
"Water level sensor/detection", "Turbidity sensor/detection", "Salinity sensor/detection", "Metal detection", "Piezoelectric sensor/detection",
|
443 |
-
"Photovoltaic sensor/detection", "Thermocouple sensor/detection", "Hall effect sensor/detection", "Ultrasonic sensor/detection", "Radar sensor/detection",
|
444 |
-
"Lidar sensor/detection", "Touch sensor/detection", "Gesture sensor/detection", "Heart rate sensor/detection", "Blood pressure sensor/detection"
|
445 |
-
],
|
446 |
-
"Size and Shape Change": [
|
447 |
-
"Volume increase/decrease", "Length increase/decrease", "Width increase/decrease", "Height increase/decrease",
|
448 |
-
"Density change", "Weight increase/decrease", "Shape deformation", "State change", "Uneven deformation",
|
449 |
-
"Complex shape deformation", "Twisting/entwining", "Non-uniform expansion/contraction", "Rounded/sharpened edges",
|
450 |
-
"Cracking/splitting", "Fragmentation", "Water resistance", "Dust resistance", "Denting/recovery",
|
451 |
-
"Folding/unfolding", "Compression/expansion", "Stretching/contraction", "Wrinkling/flattening", "Crushing/hardening",
|
452 |
-
"Rolling/unrolling", "Bending/curving"
|
453 |
-
],
|
454 |
-
"Surface and Appearance Change": [
|
455 |
-
"Color change", "Texture change", "Transparency change", "Glossy/matte change",
|
456 |
-
"Light reflection variation", "Pattern change", "Angle-dependent color change", "Light-induced color change",
|
457 |
-
"Temperature-dependent color change", "Holographic effect", "Angle-specific light reflection", "Surface shape alteration",
|
458 |
-
"Nano-scale surface structure change", "Self-cleaning effect", "Stain/pattern formation", "Blurriness/clarity change",
|
459 |
-
"Luster/shine change", "Hue/saturation change", "Luminescence/fluorescence", "Light scattering effect",
|
460 |
-
"Light absorption change", "Translucency effect", "Shadow effect change", "UV response change",
|
461 |
-
"Glow effect"
|
462 |
-
],
|
463 |
-
"Material State Change": [
|
464 |
-
"Solid/liquid/gas transition", "Crystallization/dissolution", "Oxidation/corrosion", "Hardening/softening",
|
465 |
-
"Special state transition", "Amorphous/crystalline transition", "Component separation", "Particle formation/disintegration",
|
466 |
-
"Gel formation/dissolution", "Metastable state change", "Molecular self-assembly/disintegration", "Delayed state change",
|
467 |
-
"Melting", "Solidification", "Evaporation/condensation", "Sublimation/deposition", "Precipitation/suspension", "Dispersion/aggregation",
|
468 |
-
"Drying/moistening", "Swelling/shrinkage", "Freezing/thawing", "Weathering/erosion", "Charging/discharging",
|
469 |
-
"Bonding/separation", "Fermentation/decay"
|
470 |
-
],
|
471 |
-
"Movement Characteristics Change": [
|
472 |
-
"Acceleration/deceleration", "Maintaining constant speed", "Vibration/vibration reduction", "Collision/bouncing",
|
473 |
-
"Increase/decrease in rotational speed", "Change in rotational direction", "Irregular movement", "Stop-and-slide phenomenon",
|
474 |
-
"Resonance/anti-resonance", "Resistance/lift change in fluid", "Change in movement resistance", "Complex vibrational movement",
|
475 |
-
"Movement in special fluid", "Rotational-translational movement", "Inertial stoppage", "Shock absorption",
|
476 |
-
"Shock transfer", "Conservation of momentum", "Friction change", "Overcoming inertia", "Unstable equilibrium",
|
477 |
-
"Dynamic stability", "Damping of oscillation", "Path predictability", "Evasive movement"
|
478 |
-
],
|
479 |
-
"Structural Change": [
|
480 |
-
"Addition/removal of components", "Assembly/disassembly", "Folding/unfolding", "Deformation/recovery", "Optimal structural change",
|
481 |
-
"Self-rearrangement", "Natural pattern formation/disappearance", "Regular pattern change", "Modular transformation",
|
482 |
-
"Increased structural complexity", "Memory of original shape effect", "Shape change over time", "Partial removal",
|
483 |
-
"Partial replacement", "Bonding", "Separation", "Division/integration", "Overlaying", "Internal structure change",
|
484 |
-
"External structure change", "Shift of center axis", "Balance point change", "Hierarchical structure change", "Support structure change",
|
485 |
-
"Stress distribution structure", "Shock absorption structure", "Grid/matrix structure change", "Interconnectivity change"
|
486 |
-
],
|
487 |
-
"Spatial Movement": [
|
488 |
-
"Forward/backward movement", "Left/right movement", "Up/down movement", "Vertical axis rotation (nodding)",
|
489 |
-
"Horizontal axis rotation (shaking head)", "Longitudinal axis rotation (tilting sideways)", "Circular motion", "Spiral movement",
|
490 |
-
"Slipping due to inertia", "Change of rotation axis", "Irregular rotation", "Shaking movement", "Parabolic motion",
|
491 |
-
"Zero-gravity floating", "Floating on water surface", "Jump/leap", "Sliding", "Rolling", "Free fall",
|
492 |
-
"Reciprocating motion", "Elastic bouncing", "Penetration", "Evasive movement", "Zigzag movement", "Swinging movement"
|
493 |
-
],
|
494 |
-
"Time-Related Change": [
|
495 |
-
"Aging/weathering", "Wear/corrosion", "Fading/discoloration", "Damage/recovery", "Lifecycle change",
|
496 |
-
"Adaptation through user interaction", "Learning-based shape optimization", "Property change over time",
|
497 |
-
"Collective memory effect", "Cultural significance change", "Delayed response", "History-dependent change",
|
498 |
-
"Gradual time change", "Evolutionary change", "Periodic regeneration", "Seasonal adaptation",
|
499 |
-
"Circadian rhythm change", "Lifecycle stage", "Growth/decline", "Self-repair/regeneration",
|
500 |
-
"Natural cycle adaptation", "Persistence/transience", "Memory effect", "Delayed effect", "Cumulative effect"
|
501 |
-
],
|
502 |
-
"Light and Visual Effects": [
|
503 |
-
"Illumination/shutdown", "Light transmission/blocking", "Light scattering/concentration", "Color spectrum change", "Light diffraction",
|
504 |
-
"Light interference", "Hologram creation", "Laser effect", "Light polarization", "Fluorescence/phosphorescence",
|
505 |
-
"UV/IR emission", "Optical illusion", "Light refraction", "Shadow creation/removal",
|
506 |
-
"Chromatic aberration", "Rainbow effect", "Glow effect", "Flash effect", "Lighting pattern",
|
507 |
-
"Beam effect", "Light filter effect", "Change in light direction", "Projection effect", "Light detection/response",
|
508 |
-
"Luminance change"
|
509 |
-
],
|
510 |
-
"Sound and Vibration Effects": [
|
511 |
"Sound generation/cessation", "Pitch change", "Volume change", "Timbre change",
|
512 |
"Resonance/antiresonance", "Acoustic vibration", "Ultrasonic/infrasonic emission", "Sound concentration/distribution",
|
513 |
"Sound reflection/absorption", "Acoustic Doppler effect", "Sound wave interference", "Acoustic resonance",
|
@@ -696,10 +433,8 @@ def process_inputs_lang(text1, text2, text3, selected_category, categories_dict,
|
|
696 |
text1 = text1.strip() if text1 else None
|
697 |
text2 = text2.strip() if text2 else None
|
698 |
text3 = text3.strip() if text3 else None
|
699 |
-
|
700 |
if not text1:
|
701 |
return "์ค๋ฅ: ์ต์ ํ๋์ ํค์๋๋ฅผ ์
๋ ฅํด์ฃผ์ธ์." if lang=="ko" else "Error: Please enter at least one keyword."
|
702 |
-
|
703 |
if lang == "ko":
|
704 |
progress(0.05, desc="์์ด๋์ด ์์ฑ ์ค๋น ์ค...")
|
705 |
time.sleep(0.3)
|
@@ -708,9 +443,7 @@ def process_inputs_lang(text1, text2, text3, selected_category, categories_dict,
|
|
708 |
progress(0.05, desc="Preparing idea generation...")
|
709 |
time.sleep(0.3)
|
710 |
progress(0.1, desc="Generating creative idea...")
|
711 |
-
|
712 |
results = generate_transformations_lang(text1, text2, text3, selected_category, categories_dict, lang)
|
713 |
-
|
714 |
if lang == "ko":
|
715 |
progress(0.8, desc="๊ฒฐ๊ณผ ํฌ๋งทํ
์ค...")
|
716 |
formatted = format_results_lang(results, lang)
|
@@ -741,6 +474,41 @@ def get_warning_message_lang(lang="ko"):
|
|
741 |
return "โ ๏ธ ํ๊ฒฝ ๋ณ์ GEMINI_API_KEY๊ฐ ์ค์ ๋์ง ์์์ต๋๋ค. Gemini API ํค๋ฅผ ์ค์ ํ์ธ์." if lang=="ko" else "โ ๏ธ The GEMINI_API_KEY environment variable is not set. Please set your Gemini API key."
|
742 |
return ""
|
743 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
744 |
|
745 |
##############################################################################
|
746 |
# Gradio UI with Two Tabs: English (Main Home) and Korean
|
@@ -749,7 +517,6 @@ with gr.Blocks(
|
|
749 |
title="Idea Transformer",
|
750 |
theme=gr.themes.Soft(primary_hue="teal", secondary_hue="slate", neutral_hue="neutral")
|
751 |
) as demo:
|
752 |
-
|
753 |
gr.HTML("""
|
754 |
<style>
|
755 |
body {
|
@@ -792,9 +559,7 @@ with gr.Blocks(
|
|
792 |
with gr.Tab(label="English"):
|
793 |
gr.Markdown("# ๐ Idea Transformer")
|
794 |
gr.Markdown("Based on up to **three keywords** and a **selected category**, this tool generates a creative transformation idea and a design image using the expanded idea as a prompt. https://discord.gg/openfreeai")
|
795 |
-
|
796 |
warning_en = gr.Markdown(get_warning_message_lang("en"))
|
797 |
-
|
798 |
with gr.Row():
|
799 |
with gr.Column(scale=1):
|
800 |
text_input1_en = gr.Textbox(label="Keyword 1 (required)", placeholder="e.g., Smartphone")
|
@@ -807,7 +572,6 @@ with gr.Blocks(
|
|
807 |
info="Select a category."
|
808 |
)
|
809 |
status_msg_en = gr.Markdown("๐ก Click the 'Generate Idea' button to create an idea and design image based on the selected category.")
|
810 |
-
|
811 |
processing_indicator_en = gr.HTML("""
|
812 |
<div style="display: flex; justify-content: center; align-items: center; margin: 10px 0;">
|
813 |
<div style="border: 5px solid #f3f3f3; border-top: 5px solid #3498db; border-radius: 50%; width: 30px; height: 30px; animation: spin 2s linear infinite;"></div>
|
@@ -820,13 +584,10 @@ with gr.Blocks(
|
|
820 |
}
|
821 |
</style>
|
822 |
""", visible=False)
|
823 |
-
|
824 |
submit_button_en = gr.Button("Generate Idea", variant="primary")
|
825 |
-
|
826 |
with gr.Column(scale=2):
|
827 |
idea_output_en = gr.Markdown(label="Idea Output")
|
828 |
generated_image_en = gr.Image(label="Generated Design Image", type="pil")
|
829 |
-
|
830 |
gr.Examples(
|
831 |
examples=[
|
832 |
["Smartphone", "", "", "Sensor Functions"],
|
@@ -836,14 +597,14 @@ with gr.Blocks(
|
|
836 |
["Sneakers", "Wearable", "Health", "Structural Change"],
|
837 |
],
|
838 |
inputs=[text_input1_en, text_input2_en, text_input3_en, category_radio_en],
|
|
|
|
|
|
|
839 |
)
|
840 |
-
|
841 |
def show_processing_indicator_en():
|
842 |
return gr.update(visible=True)
|
843 |
-
|
844 |
def hide_processing_indicator_en():
|
845 |
return gr.update(visible=False)
|
846 |
-
|
847 |
submit_button_en.click(
|
848 |
fn=show_processing_indicator_en,
|
849 |
inputs=None,
|
@@ -857,13 +618,10 @@ with gr.Blocks(
|
|
857 |
inputs=None,
|
858 |
outputs=processing_indicator_en
|
859 |
)
|
860 |
-
|
861 |
with gr.Tab(label="ํ๊ตญ์ด"):
|
862 |
gr.Markdown("# ๐ ์์ด๋์ด ํธ๋์คํฌ๋จธ")
|
863 |
gr.Markdown("์
๋ ฅํ **ํค์๋**(์ต๋ 3๊ฐ)์ **์นดํ
๊ณ ๋ฆฌ**๋ฅผ ๋ฐํ์ผ๋ก, ์ฐฝ์์ ์ธ ๋ชจ๋ธ/์ปจ์
/ํ์ ๋ณํ ์์ด๋์ด๋ฅผ ์์ฑํ๊ณ , ํด๋น ํ์ฅ ์์ด๋์ด๋ฅผ ํ๋กฌํํธ๋ก ํ์ฌ ๋์์ธ ์ด๋ฏธ์ง๋ฅผ ์์ฑํฉ๋๋ค. https://discord.gg/openfreeai")
|
864 |
-
|
865 |
warning_ko = gr.Markdown(get_warning_message_lang("ko"))
|
866 |
-
|
867 |
with gr.Row():
|
868 |
with gr.Column(scale=1):
|
869 |
text_input1_ko = gr.Textbox(label="ํค์๋ 1 (ํ์)", placeholder="์: ์ค๋งํธํฐ")
|
@@ -876,7 +634,6 @@ with gr.Blocks(
|
|
876 |
info="์ถ๋ ฅํ ์นดํ
๊ณ ๋ฆฌ๋ฅผ ์ ํํ์ธ์."
|
877 |
)
|
878 |
status_msg_ko = gr.Markdown("๐ก '์์ด๋์ด ์์ฑํ๊ธฐ' ๋ฒํผ์ ํด๋ฆญํ๋ฉด ์ ํํ ์นดํ
๊ณ ๋ฆฌ์ ํด๋นํ๋ ์์ด๋์ด์ ๋์์ธ ์ด๋ฏธ์ง๊ฐ ์์ฑ๋ฉ๋๋ค.")
|
879 |
-
|
880 |
processing_indicator_ko = gr.HTML("""
|
881 |
<div style="display: flex; justify-content: center; align-items: center; margin: 10px 0;">
|
882 |
<div style="border: 5px solid #f3f3f3; border-top: 5px solid #3498db; border-radius: 50%; width: 30px; height: 30px; animation: spin 2s linear infinite;"></div>
|
@@ -889,13 +646,10 @@ with gr.Blocks(
|
|
889 |
}
|
890 |
</style>
|
891 |
""", visible=False)
|
892 |
-
|
893 |
submit_button_ko = gr.Button("์์ด๋์ด ์์ฑํ๊ธฐ", variant="primary")
|
894 |
-
|
895 |
with gr.Column(scale=2):
|
896 |
idea_output_ko = gr.Markdown(label="์์ด๋์ด ๊ฒฐ๊ณผ")
|
897 |
generated_image_ko = gr.Image(label="์์ฑ๋ ๋์์ธ ์ด๋ฏธ์ง", type="pil")
|
898 |
-
|
899 |
gr.Examples(
|
900 |
examples=[
|
901 |
["์ค๋งํธํฐ", "", "", "์ผ์ ๊ธฐ๋ฅ"],
|
@@ -904,15 +658,12 @@ with gr.Blocks(
|
|
904 |
["๋๋ก ", "์ธ๊ณต์ง๋ฅ", "", "๋ฌผ์ง์ ์ํ ๋ณํ"],
|
905 |
["์ด๋ํ", "์จ์ด๋ฌ๋ธ", "๊ฑด๊ฐ", "๊ตฌ์กฐ์ ๋ณํ"],
|
906 |
],
|
907 |
-
inputs=[text_input1_ko, text_input2_ko, text_input3_ko, category_radio_ko]
|
908 |
)
|
909 |
-
|
910 |
def show_processing_indicator_ko():
|
911 |
return gr.update(visible=True)
|
912 |
-
|
913 |
def hide_processing_indicator_ko():
|
914 |
return gr.update(visible=False)
|
915 |
-
|
916 |
submit_button_ko.click(
|
917 |
fn=show_processing_indicator_ko,
|
918 |
inputs=None,
|
|
|
30 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
31 |
|
32 |
dtype = torch.bfloat16 if device == "cuda" else torch.float32
|
|
|
33 |
print(f"Using device: {device}, dtype: {dtype}")
|
34 |
|
35 |
##############################################################################
|
|
|
41 |
model="Helsinki-NLP/opus-mt-ko-en",
|
42 |
device=0 if device == "cuda" else -1
|
43 |
)
|
|
|
44 |
pipe = DiffusionPipeline.from_pretrained(
|
45 |
"black-forest-labs/FLUX.1-schnell",
|
46 |
torch_dtype=dtype
|
47 |
).to(device)
|
|
|
48 |
print("Models loaded successfully")
|
49 |
except Exception as e:
|
50 |
print(f"Error loading models: {e}")
|
51 |
def dummy_translator(text):
|
52 |
return [{'translation_text': text}]
|
|
|
53 |
class DummyPipe:
|
54 |
def __call__(self, **kwargs):
|
55 |
from PIL import Image
|
|
|
59 |
def __init__(self, img):
|
60 |
self.images = [img]
|
61 |
return DummyResult(dummy_img)
|
|
|
62 |
translator = dummy_translator
|
63 |
pipe = DummyPipe()
|
64 |
|
|
|
97 |
def generate_design_image(prompt, seed=42, randomize_seed=True, width=1024, height=1024, num_inference_steps=4):
|
98 |
original_prompt = prompt
|
99 |
translated = False
|
|
|
100 |
# Clean the input text
|
101 |
prompt = clean_input_text(prompt)
|
|
|
102 |
# Pre-process: if input is too long, trim to 1000 characters
|
103 |
if len(prompt) > 1000:
|
104 |
prompt = prompt[:1000]
|
|
|
105 |
if contains_korean(prompt):
|
106 |
# When calling translation, add max_length and truncation options to avoid length issues
|
107 |
translation = translator(prompt, max_length=400, truncation=True)
|
108 |
prompt = translation[0]['translation_text']
|
109 |
translated = True
|
|
|
110 |
if randomize_seed:
|
111 |
seed = random.randint(0, MAX_SEED)
|
|
|
112 |
generator = torch.Generator(device=device).manual_seed(seed)
|
|
|
113 |
image = pipe(
|
114 |
prompt=prompt,
|
115 |
width=width,
|
|
|
118 |
generator=generator,
|
119 |
guidance_scale=0.0
|
120 |
).images[0]
|
|
|
121 |
return image
|
122 |
|
123 |
##############################################################################
|
|
|
245 |
"๊ด๋ ๋ณํ"
|
246 |
],
|
247 |
"์๋ฆฌ์ ์ง๋ ํจ๊ณผ": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
248 |
"Sound generation/cessation", "Pitch change", "Volume change", "Timbre change",
|
249 |
"Resonance/antiresonance", "Acoustic vibration", "Ultrasonic/infrasonic emission", "Sound concentration/distribution",
|
250 |
"Sound reflection/absorption", "Acoustic Doppler effect", "Sound wave interference", "Acoustic resonance",
|
|
|
433 |
text1 = text1.strip() if text1 else None
|
434 |
text2 = text2.strip() if text2 else None
|
435 |
text3 = text3.strip() if text3 else None
|
|
|
436 |
if not text1:
|
437 |
return "์ค๋ฅ: ์ต์ ํ๋์ ํค์๋๋ฅผ ์
๋ ฅํด์ฃผ์ธ์." if lang=="ko" else "Error: Please enter at least one keyword."
|
|
|
438 |
if lang == "ko":
|
439 |
progress(0.05, desc="์์ด๋์ด ์์ฑ ์ค๋น ์ค...")
|
440 |
time.sleep(0.3)
|
|
|
443 |
progress(0.05, desc="Preparing idea generation...")
|
444 |
time.sleep(0.3)
|
445 |
progress(0.1, desc="Generating creative idea...")
|
|
|
446 |
results = generate_transformations_lang(text1, text2, text3, selected_category, categories_dict, lang)
|
|
|
447 |
if lang == "ko":
|
448 |
progress(0.8, desc="๊ฒฐ๊ณผ ํฌ๋งทํ
์ค...")
|
449 |
formatted = format_results_lang(results, lang)
|
|
|
474 |
return "โ ๏ธ ํ๊ฒฝ ๋ณ์ GEMINI_API_KEY๊ฐ ์ค์ ๋์ง ์์์ต๋๋ค. Gemini API ํค๋ฅผ ์ค์ ํ์ธ์." if lang=="ko" else "โ ๏ธ The GEMINI_API_KEY environment variable is not set. Please set your Gemini API key."
|
475 |
return ""
|
476 |
|
477 |
+
##############################################################################
|
478 |
+
# Add "Business Ideas" category to each dictionary
|
479 |
+
##############################################################################
|
480 |
+
physical_transformation_categories["๋น์ฆ๋์ค ์์ด๋์ด"] = [
|
481 |
+
"์์ฅ ์ฌ์ ์/์ ๊ท ์์ฅ ๊ฐ์ฒ",
|
482 |
+
"๋น์ฆ๋์ค ๋ชจ๋ธ ํ์ /๋์งํธ ์ ํ",
|
483 |
+
"๊ณ ๊ฐ ๊ฒฝํ ํ์ /์๋น์ค ํ์ ",
|
484 |
+
"ํ๋ ฅ ๋ฐ ํํธ๋์ญ ๊ฐํ/์ํ๊ณ ๊ตฌ์ถ",
|
485 |
+
"๊ธ๋ก๋ฒ ํ์ฅ/์ง์ญํ ์ ๋ต",
|
486 |
+
"์ด์ ํจ์จ์ฑ ์ฆ๋/์๊ฐ ์ ๊ฐ",
|
487 |
+
"๋ธ๋๋ ๋ฆฌํฌ์ง์
๋/์ด๋ฏธ์ง ์ ํ",
|
488 |
+
"์ง์ ๊ฐ๋ฅํ ์ฑ์ฅ/์ฌํ์ ๊ฐ์น ์ฐฝ์ถ",
|
489 |
+
"๋ฐ์ดํฐ ๊ธฐ๋ฐ ์์ฌ๊ฒฐ์ /AI ๋์
",
|
490 |
+
"์ ๊ธฐ์ ์ตํฉ/ํ์ ํฌ์"
|
491 |
+
]
|
492 |
+
|
493 |
+
physical_transformation_categories_en["Business Ideas"] = [
|
494 |
+
"Market redefinition/new market creation",
|
495 |
+
"Business model innovation/digital transformation",
|
496 |
+
"Customer experience and service innovation",
|
497 |
+
"Enhanced partnerships and ecosystem building",
|
498 |
+
"Global expansion and localization strategy",
|
499 |
+
"Operational efficiency improvement/cost reduction",
|
500 |
+
"Brand repositioning/image transformation",
|
501 |
+
"Sustainable growth and social value creation",
|
502 |
+
"Data-driven decision making/AI adoption",
|
503 |
+
"Convergence of new technologies/innovative investments"
|
504 |
+
]
|
505 |
+
|
506 |
+
##############################################################################
|
507 |
+
# Helper function for caching examples in the English tab
|
508 |
+
##############################################################################
|
509 |
+
def process_all_lang_example(text1, text2, text3, selected_category):
|
510 |
+
# ๊ณ ์ ๋ state๊ฐ(physical_transformation_categories_en, "en")์ผ๋ก ํธ์ถ
|
511 |
+
return process_all_lang(text1, text2, text3, selected_category, physical_transformation_categories_en, "en")
|
512 |
|
513 |
##############################################################################
|
514 |
# Gradio UI with Two Tabs: English (Main Home) and Korean
|
|
|
517 |
title="Idea Transformer",
|
518 |
theme=gr.themes.Soft(primary_hue="teal", secondary_hue="slate", neutral_hue="neutral")
|
519 |
) as demo:
|
|
|
520 |
gr.HTML("""
|
521 |
<style>
|
522 |
body {
|
|
|
559 |
with gr.Tab(label="English"):
|
560 |
gr.Markdown("# ๐ Idea Transformer")
|
561 |
gr.Markdown("Based on up to **three keywords** and a **selected category**, this tool generates a creative transformation idea and a design image using the expanded idea as a prompt. https://discord.gg/openfreeai")
|
|
|
562 |
warning_en = gr.Markdown(get_warning_message_lang("en"))
|
|
|
563 |
with gr.Row():
|
564 |
with gr.Column(scale=1):
|
565 |
text_input1_en = gr.Textbox(label="Keyword 1 (required)", placeholder="e.g., Smartphone")
|
|
|
572 |
info="Select a category."
|
573 |
)
|
574 |
status_msg_en = gr.Markdown("๐ก Click the 'Generate Idea' button to create an idea and design image based on the selected category.")
|
|
|
575 |
processing_indicator_en = gr.HTML("""
|
576 |
<div style="display: flex; justify-content: center; align-items: center; margin: 10px 0;">
|
577 |
<div style="border: 5px solid #f3f3f3; border-top: 5px solid #3498db; border-radius: 50%; width: 30px; height: 30px; animation: spin 2s linear infinite;"></div>
|
|
|
584 |
}
|
585 |
</style>
|
586 |
""", visible=False)
|
|
|
587 |
submit_button_en = gr.Button("Generate Idea", variant="primary")
|
|
|
588 |
with gr.Column(scale=2):
|
589 |
idea_output_en = gr.Markdown(label="Idea Output")
|
590 |
generated_image_en = gr.Image(label="Generated Design Image", type="pil")
|
|
|
591 |
gr.Examples(
|
592 |
examples=[
|
593 |
["Smartphone", "", "", "Sensor Functions"],
|
|
|
597 |
["Sneakers", "Wearable", "Health", "Structural Change"],
|
598 |
],
|
599 |
inputs=[text_input1_en, text_input2_en, text_input3_en, category_radio_en],
|
600 |
+
fn=process_all_lang_example,
|
601 |
+
outputs=[idea_output_en, generated_image_en],
|
602 |
+
cache_examples=True
|
603 |
)
|
|
|
604 |
def show_processing_indicator_en():
|
605 |
return gr.update(visible=True)
|
|
|
606 |
def hide_processing_indicator_en():
|
607 |
return gr.update(visible=False)
|
|
|
608 |
submit_button_en.click(
|
609 |
fn=show_processing_indicator_en,
|
610 |
inputs=None,
|
|
|
618 |
inputs=None,
|
619 |
outputs=processing_indicator_en
|
620 |
)
|
|
|
621 |
with gr.Tab(label="ํ๊ตญ์ด"):
|
622 |
gr.Markdown("# ๐ ์์ด๋์ด ํธ๋์คํฌ๋จธ")
|
623 |
gr.Markdown("์
๋ ฅํ **ํค์๋**(์ต๋ 3๊ฐ)์ **์นดํ
๊ณ ๋ฆฌ**๋ฅผ ๋ฐํ์ผ๋ก, ์ฐฝ์์ ์ธ ๋ชจ๋ธ/์ปจ์
/ํ์ ๋ณํ ์์ด๋์ด๋ฅผ ์์ฑํ๊ณ , ํด๋น ํ์ฅ ์์ด๋์ด๋ฅผ ํ๋กฌํํธ๋ก ํ์ฌ ๋์์ธ ์ด๋ฏธ์ง๋ฅผ ์์ฑํฉ๋๋ค. https://discord.gg/openfreeai")
|
|
|
624 |
warning_ko = gr.Markdown(get_warning_message_lang("ko"))
|
|
|
625 |
with gr.Row():
|
626 |
with gr.Column(scale=1):
|
627 |
text_input1_ko = gr.Textbox(label="ํค์๋ 1 (ํ์)", placeholder="์: ์ค๋งํธํฐ")
|
|
|
634 |
info="์ถ๋ ฅํ ์นดํ
๊ณ ๋ฆฌ๋ฅผ ์ ํํ์ธ์."
|
635 |
)
|
636 |
status_msg_ko = gr.Markdown("๐ก '์์ด๋์ด ์์ฑํ๊ธฐ' ๋ฒํผ์ ํด๋ฆญํ๋ฉด ์ ํํ ์นดํ
๊ณ ๋ฆฌ์ ํด๋นํ๋ ์์ด๋์ด์ ๋์์ธ ์ด๋ฏธ์ง๊ฐ ์์ฑ๋ฉ๋๋ค.")
|
|
|
637 |
processing_indicator_ko = gr.HTML("""
|
638 |
<div style="display: flex; justify-content: center; align-items: center; margin: 10px 0;">
|
639 |
<div style="border: 5px solid #f3f3f3; border-top: 5px solid #3498db; border-radius: 50%; width: 30px; height: 30px; animation: spin 2s linear infinite;"></div>
|
|
|
646 |
}
|
647 |
</style>
|
648 |
""", visible=False)
|
|
|
649 |
submit_button_ko = gr.Button("์์ด๋์ด ์์ฑํ๊ธฐ", variant="primary")
|
|
|
650 |
with gr.Column(scale=2):
|
651 |
idea_output_ko = gr.Markdown(label="์์ด๋์ด ๊ฒฐ๊ณผ")
|
652 |
generated_image_ko = gr.Image(label="์์ฑ๋ ๋์์ธ ์ด๋ฏธ์ง", type="pil")
|
|
|
653 |
gr.Examples(
|
654 |
examples=[
|
655 |
["์ค๋งํธํฐ", "", "", "์ผ์ ๊ธฐ๋ฅ"],
|
|
|
658 |
["๋๋ก ", "์ธ๊ณต์ง๋ฅ", "", "๋ฌผ์ง์ ์ํ ๋ณํ"],
|
659 |
["์ด๋ํ", "์จ์ด๋ฌ๋ธ", "๊ฑด๊ฐ", "๊ตฌ์กฐ์ ๋ณํ"],
|
660 |
],
|
661 |
+
inputs=[text_input1_ko, text_input2_ko, text_input3_ko, category_radio_ko]
|
662 |
)
|
|
|
663 |
def show_processing_indicator_ko():
|
664 |
return gr.update(visible=True)
|
|
|
665 |
def hide_processing_indicator_ko():
|
666 |
return gr.update(visible=False)
|
|
|
667 |
submit_button_ko.click(
|
668 |
fn=show_processing_indicator_ko,
|
669 |
inputs=None,
|