openfree commited on
Commit
4256532
·
verified ·
1 Parent(s): 3121727

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -127
app.py CHANGED
@@ -266,133 +266,6 @@ physical_transformation_categories = {
266
  ]
267
  }
268
 
269
- # English version
270
- physical_transformation_categories_en = {
271
- "Sensor Functions": [
272
- "Visual sensor/detection", "Auditory sensor/detection", "Tactile sensor/detection", "Taste sensor/detection", "Olfactory sensor/detection",
273
- "Temperature sensor/detection", "Humidity sensor/detection", "Pressure sensor/detection", "Acceleration sensor/detection", "Rotational sensor/detection",
274
- "Proximity sensor/detection", "Position sensor/detection", "Motion sensor/detection", "Gas sensor/detection", "Infrared sensor/detection",
275
- "Ultraviolet sensor/detection", "Radiation sensor/detection", "Magnetic sensor/detection", "Electric field sensor/detection", "Chemical sensor/detection",
276
- "Biosignal sensor/detection", "Vibration sensor/detection", "Noise sensor/detection", "Light intensity sensor/detection", "Light wavelength sensor/detection",
277
- "Tilt sensor/detection", "pH sensor/detection", "Current sensor/detection", "Voltage sensor/detection", "Image sensor/detection",
278
- "Distance sensor/detection", "Depth sensor/detection", "Gravity sensor/detection", "Speed sensor/detection", "Flow sensor/detection",
279
- "Water level sensor/detection", "Turbidity sensor/detection", "Salinity sensor/detection", "Metal detection", "Piezoelectric sensor/detection",
280
- "Photovoltaic sensor/detection", "Thermocouple sensor/detection", "Hall effect sensor/detection", "Ultrasonic sensor/detection", "Radar sensor/detection",
281
- "Lidar sensor/detection", "Touch sensor/detection", "Gesture sensor/detection", "Heart rate sensor/detection", "Blood pressure sensor/detection"
282
- ],
283
- "Size and Shape Change": [
284
- "Volume increase/decrease", "Length increase/decrease", "Width increase/decrease", "Height increase/decrease",
285
- "Density change", "Weight increase/decrease", "Shape deformation", "State change", "Uneven deformation",
286
- "Complex shape deformation", "Twisting/entwining", "Non-uniform expansion/contraction", "Rounded/sharpened edges",
287
- "Cracking/splitting", "Fragmentation", "Water resistance", "Dust resistance", "Denting/recovery",
288
- "Folding/unfolding", "Compression/expansion", "Stretching/contraction", "Wrinkling/flattening", "Crushing/hardening",
289
- "Rolling/unrolling", "Bending/curving"
290
- ],
291
- "Surface and Appearance Change": [
292
- "Color change", "Texture change", "Transparency change", "Glossy/matte change",
293
- "Light reflection variation", "Pattern change", "Angle-dependent color change", "Light-induced color change",
294
- "Temperature-dependent color change", "Holographic effect", "Angle-specific light reflection", "Surface shape alteration",
295
- "Nano-scale surface structure change", "Self-cleaning effect", "Stain/pattern formation", "Blurriness/clarity change",
296
- "Luster/shine change", "Hue/saturation change", "Luminescence/fluorescence", "Light scattering effect",
297
- "Light absorption change", "Translucency effect", "Shadow effect change", "UV response change",
298
- "Glow effect"
299
- ],
300
- "Material State Change": [
301
- "Solid/liquid/gas transition", "Crystallization/dissolution", "Oxidation/corrosion", "Hardening/softening",
302
- "Special state transition", "Amorphous/crystalline transition", "Component separation", "Particle formation/disintegration",
303
- "Gel formation/dissolution", "Metastable state change", "Molecular self-assembly/disintegration", "Delayed state change",
304
- "Melting", "Solidification", "Evaporation/condensation", "Sublimation/deposition", "Precipitation/suspension", "Dispersion/aggregation",
305
- "Drying/moistening", "Swelling/shrinkage", "Freezing/thawing", "Weathering/erosion", "Charging/discharging",
306
- "Bonding/separation", "Fermentation/decay"
307
- ],
308
- "Movement Characteristics Change": [
309
- "Acceleration/deceleration", "Maintaining constant speed", "Vibration/vibration reduction", "Collision/bouncing",
310
- "Increase/decrease in rotational speed", "Change in rotational direction", "Irregular movement", "Stop-and-slide phenomenon",
311
- "Resonance/anti-resonance", "Resistance/lift change in fluid", "Change in movement resistance", "Complex vibrational movement",
312
- "Movement in special fluid", "Rotational-translational movement", "Inertial stoppage", "Shock absorption",
313
- "Shock transfer", "Conservation of momentum", "Friction change", "Overcoming inertia", "Unstable equilibrium",
314
- "Dynamic stability", "Damping of oscillation", "Path predictability", "Evasive movement"
315
- ],
316
- "Structural Change": [
317
- "Addition/removal of components", "Assembly/disassembly", "Folding/unfolding", "Deformation/recovery", "Optimal structural change",
318
- "Self-rearrangement", "Natural pattern formation/disappearance", "Regular pattern change", "Modular transformation",
319
- "Increased structural complexity", "Memory of original shape effect", "Shape change over time", "Partial removal",
320
- "Partial replacement", "Bonding", "Separation", "Division/integration", "Overlaying", "Internal structure change",
321
- "External structure change", "Shift of center axis", "Balance point change", "Hierarchical structure change", "Support structure change",
322
- "Stress distribution structure", "Shock absorption structure", "Grid/matrix structure change", "Interconnectivity change"
323
- ],
324
- "Spatial Movement": [
325
- "Forward/backward movement", "Left/right movement", "Up/down movement", "Vertical axis rotation (nodding)",
326
- "Horizontal axis rotation (shaking head)", "Longitudinal axis rotation (tilting sideways)", "Circular motion", "Spiral movement",
327
- "Slipping due to inertia", "Change of rotation axis", "Irregular rotation", "Shaking movement", "Parabolic motion",
328
- "Zero-gravity floating", "Floating on water surface", "Jump/leap", "Sliding", "Rolling", "Free fall",
329
- "Reciprocating motion", "Elastic bouncing", "Penetration", "Evasive movement", "Zigzag movement", "Swinging movement"
330
- ],
331
- "Time-Related Change": [
332
- "Aging/weathering", "Wear/corrosion", "Fading/discoloration", "Damage/recovery", "Lifecycle change",
333
- "Adaptation through user interaction", "Learning-based shape optimization", "Property change over time",
334
- "Collective memory effect", "Cultural significance change", "Delayed response", "History-dependent change",
335
- "Gradual time change", "Evolutionary change", "Periodic regeneration", "Seasonal adaptation",
336
- "Circadian rhythm change", "Lifecycle stage", "Growth/decline", "Self-repair/regeneration",
337
- "Natural cycle adaptation", "Persistence/transience", "Memory effect", "Delayed effect", "Cumulative effect"
338
- ],
339
- "Light and Visual Effects": [
340
- "Illumination/shutdown", "Light transmission/blocking", "Light scattering/concentration", "Color spectrum change", "Light diffraction",
341
- "Light interference", "Hologram creation", "Laser effect", "Light polarization", "Fluorescence/phosphorescence",
342
- "UV/IR emission", "Optical illusion", "Light refraction", "Shadow creation/removal",
343
- "Chromatic aberration", "Rainbow effect", "Glow effect", "Flash effect", "Lighting pattern",
344
- "Beam effect", "Light filter effect", "Change in light direction", "Projection effect", "Light detection/response",
345
- "Luminance change"
346
- ],
347
- "Sound and Vibration Effects": [
348
- "Sound generation/cessation", "Pitch change", "Volume change", "Timbre change",
349
- "Resonance/antiresonance", "Acoustic vibration", "Ultrasonic/infrasonic emission", "Sound concentration/distribution",
350
- "Sound reflection/absorption", "Acoustic Doppler effect", "Sound wave interference", "Acoustic resonance",
351
- "Vibration pattern change", "Percussive effect", "Audio feedback", "Sound shielding/amplification",
352
- "Directional sound", "Sound distortion", "Beat generation", "Harmonics generation", "Frequency modulation",
353
- "Acoustic shockwave", "Sound filtering"
354
- ],
355
- "Thermal Changes": [
356
- "Temperature rise/fall", "Thermal expansion/contraction", "Heat transfer/blocking", "Pressure increase/decrease",
357
- "Magnetization due to heat change", "Entropy change", "Thermoelectric effect", "Magnetic-induced thermal change",
358
- "Heat storage/release during phase change", "Thermal stress buildup/release", "Impact of rapid temperature change",
359
- "Radiative cooling/heating", "Exothermic/endothermic", "Heat distribution change", "Heat reflection/absorption",
360
- "Cooling condensation", "Thermal activation", "Thermal discoloration", "Coefficient of thermal expansion change", "Thermal stability change",
361
- "Heat resistance/cold resistance", "Self-heating", "Thermal equilibrium/imbalance", "Thermal deformation", "Heat dispersion/concentration"
362
- ],
363
- "Electrical and Magnetic Changes": [
364
- "Magnetism creation/cessation", "Charge increase/decrease", "Electric field creation/cessation", "Magnetic field creation/cessation",
365
- "Superconducting transition", "Ferroelectric property change", "Quantum state change", "Plasma formation/cessation",
366
- "Spin wave transmission", "Electricity generation by light", "Electricity generation by pressure", "Current change in magnetic field",
367
- "Electrical resistance change", "Electrical conductivity change", "Static electricity generation/discharge", "Electromagnetic induction",
368
- "Electromagnetic wave emission/absorption", "Capacitance change", "Magnetic hysteresis", "Electrical polarization",
369
- "Electron flow direction change", "Electrical resonance", "Electrical shielding/exposure", "Magnetic shielding/exposure",
370
- "Magnetic field alignment"
371
- ],
372
- "Chemical Change": [
373
- "Surface coating change", "Material composition change", "Chemical reaction change", "Catalytic action start/stop",
374
- "Light-induced chemical reaction", "Electricity-induced chemical reaction", "Monolayer formation", "Molecular-level structural change",
375
- "Biomimetic surface change", "Environmentally responsive material change", "Periodic chemical reaction", "Oxidation", "Reduction",
376
- "Polymerization", "Water splitting", "Compound formation", "Radiation effects", "Acid-base reaction", "Neutralization reaction",
377
- "Ionization", "Chemical adsorption/desorption", "Catalytic efficiency change", "Enzyme activity change", "Colorimetric reaction",
378
- "pH change", "Chemical equilibrium shift", "Bond formation/breakage", "Solubility change"
379
- ],
380
- "Biological Change": [
381
- "Growth/shrinkage", "Cell division/death", "Bioluminescence", "Metabolic change", "Immune response",
382
- "Hormone secretion", "Neural response", "Genetic expression", "Adaptation/evolution", "Circadian rhythm change",
383
- "Regeneration/healing", "Aging/maturation", "Biomimetic change", "Biofilm formation", "Biological degradation",
384
- "Enzyme activation/inactivation", "Biological signaling", "Stress response", "Thermoregulation", "Biological clock change",
385
- "Extracellular matrix change", "Biomechanical response", "Cell motility", "Cell polarity change", "Nutritional status change"
386
- ],
387
- "Environmental Interaction": [
388
- "Temperature response", "Humidity response", "Pressure response", "Gravity response", "Magnetic field response",
389
- "Light response", "Sound response", "Chemical detection", "Mechanical stimulus detection", "Electrical stimulus response",
390
- "Radiation response", "Vibration detection", "pH response", "Solvent response", "Gas exchange",
391
- "Pollution response", "Weather response", "Seasonal response", "Circadian response", "Ecosystem interaction",
392
- "Symbiotic/competitive interaction", "Predator/prey relationship", "Swarm formation", "Territorial behavior", "Migration/settlement pattern"
393
- ]
394
- }
395
-
396
  ##############################################################################
397
  # Gemini API Call Function (Language Independent)
398
  ##############################################################################
@@ -578,6 +451,12 @@ def get_warning_message_lang(lang="ko"):
578
  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."
579
  return ""
580
 
 
 
 
 
 
 
581
 
582
  ##############################################################################
583
  # Gradio UI with Two Tabs: English (Main Home) and Korean
@@ -673,6 +552,8 @@ with gr.Blocks(
673
  ["Sneakers", "Wearable", "Health", "Structural Change"],
674
  ],
675
  inputs=[text_input1_en, text_input2_en, text_input3_en, category_radio_en],
 
 
676
  cache_examples=True
677
  )
678
 
 
266
  ]
267
  }
268
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
269
  ##############################################################################
270
  # Gemini API Call Function (Language Independent)
271
  ##############################################################################
 
451
  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."
452
  return ""
453
 
454
+ ##############################################################################
455
+ # Helper function for caching examples in the English tab
456
+ ##############################################################################
457
+ def process_all_lang_example(text1, text2, text3, selected_category):
458
+ # 내부적으로 state값(physical_transformation_categories_en, "en")을 고정하여 호출
459
+ return process_all_lang(text1, text2, text3, selected_category, physical_transformation_categories_en, "en")
460
 
461
  ##############################################################################
462
  # Gradio UI with Two Tabs: English (Main Home) and Korean
 
552
  ["Sneakers", "Wearable", "Health", "Structural Change"],
553
  ],
554
  inputs=[text_input1_en, text_input2_en, text_input3_en, category_radio_en],
555
+ fn=process_all_lang_example,
556
+ outputs=[idea_output_en, generated_image_en],
557
  cache_examples=True
558
  )
559