ginipick commited on
Commit
bde21aa
Β·
verified Β·
1 Parent(s): 373a32f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -16
app.py CHANGED
@@ -75,15 +75,11 @@ def load_gallery():
75
  if os.path.exists(GALLERY_JSON):
76
  with open(GALLERY_JSON, "r") as f:
77
  gallery = json.load(f)
78
- return [{"image": item["video"], "caption": item["prompt"]} for item in reversed(gallery)]
79
  return []
80
 
81
  def update_gallery():
82
- gallery_items = load_gallery()
83
- return [
84
- {"video": item['image'], "caption": item['caption']}
85
- for item in gallery_items
86
- ]
87
 
88
  def respond(image, prompt, steps, cfg_scale, eta, fs, seed, video_length):
89
  logging.info(f"Received prompt: {prompt}, steps: {steps}, cfg_scale: {cfg_scale}, "
@@ -133,13 +129,13 @@ examples = [
133
  ["A man climbing a rock wall reaching for the next hold", "q25.png"],
134
  ["pov of an austronaut holding a small red rock that has a portal showing the Statue of Liberty, alien landscape of a red planet in the background, surreal","q26.png"],
135
  ["a smartphone product showcase, smartphone display showing immersive wallpaper and time, blurred turquoise background","q27.png"],
136
- ["A glamorous young woman with long, wavy blonde hair and smokey eye makeup, posing in a luxury hotel room. She’s wearing a sparkly gold cocktail dress and holding up a white card with 'openfree.ai' written on it in elegant calligraphy. Soft, warm lighting creates a luxurious atmosphere. ", "q1.webp"],
137
  ["A fit male fitness influencer with short dark hair and stubble, standing shirtless in a modern gym. He has defined abs and arm muscles, and is holding a protein shake in one hand and a card that says 'openfree.ai' in the other. Bright, clean lighting highlights his physique.", "q2.webp"],
138
- ["A bohemian-style female travel blogger with sun-kissed skin and messy beach waves, sitting on a tropical beach at sunset. She’s wearing a flowy white sundress and holding up a weathered postcard with 'openfree.ai' scrawled on it. Golden hour lighting bathes the scene in warm tones. ", "q3.webp"],
139
- ["A trendy male fashion influencer with perfectly styled hair and designer stubble, posing on a city street. He’s wearing a tailored suit and holding up a sleek black business card with 'openfree.ai' printed in minimalist white font. The background shows blurred city lights, creating a chic urban atmosphere.", "q4.webp"],
140
- ["A fresh-faced young female beauty guru with freckles and natural makeup, sitting at a vanity covered in cosmetics. She’s wearing a pastel pink robe and holding up a makeup palette with 'openfree.ai' written on it in lipstick. Soft, flattering lighting enhances her radiant complexion. ", "q5.webp"],
141
- ["A stylish young woman with long, wavy ombre hair and winged eyeliner, posing in front of a neon-lit city skyline at night. She’s wearing a sleek black leather jacket over a sparkly crop top and holding up a holographic business card that says 'openfree.ai' in futuristic font. The card reflects the colorful neon lights, creating a cyberpunk aesthetic.", "q6.webp"],
142
- ["Create a surreal advertisement poster for a fictional time travel agency. The background should depict a swirling vortex of clock faces and historical landmarks from different eras. In the foreground, place large, bold text that reads β€œAI TOURS: YOUR PAST IS OUR FUTURE” in a retro-futuristic font. The text should appear to be partially disintegrating into particles that are being sucked into the time vortex. Include smaller text at the bottom with fictional pricing and the slogan β€œHistory is just a ticket away!”", "q7.webp"],
143
  ["Photo realistic scene inspired by LOTR: [A tiny red dragon sleeps curled up in a nest on a medieval wizard's table]. Shot with a macro lens (f/2.8, 50mm) and a Canon EOSR5, the soft focus captures [the cozy morning light filtering through a near by window]. The pastel colors and whimsical steam shapes enhance the serene atmosphere, evoking a DnD RPG setting. The image is rendered in 16K and 8K, highlighting [the intricate details and medieval charm].", "q8.webp"],
144
  ["μ¬κΈ€λΌμŠ€λ₯Ό μ°©μš©ν•œ κ·€μ—¬μš΄ κ°•μ•„μ§€κ°€ 'Openfree.ai'라고 μ“°μ—¬μ§„ ν‘œμ§€νŒμ„ λ“€κ³ μžˆλ‹€.", "q9.webp"],
145
  ["미레적인 λ„μ‹œμ˜ ν•΄μ§€λŠ” 풍경", "q10.webp"],
@@ -155,12 +151,11 @@ examples = [
155
  ["A fantasy map of a fictional world, with detailed terrain and cities.", "q19.webp"]
156
  ]
157
 
158
-
159
  def use_prompt_and_image(prompt, image):
160
  return prompt, image
161
 
162
  def show_video(evt: gr.SelectData):
163
- return evt.value["video"] if isinstance(evt.value, dict) and "video" in evt.value else None
164
 
165
  with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css) as demo:
166
  with gr.Tab("Generate"):
@@ -200,8 +195,7 @@ with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css) as demo:
200
  columns=[5],
201
  rows=[3],
202
  object_fit="contain",
203
- height="auto",
204
- preview=True
205
  )
206
  selected_video = gr.Video(label="Selected Video")
207
  refresh_btn = gr.Button("Refresh Gallery")
 
75
  if os.path.exists(GALLERY_JSON):
76
  with open(GALLERY_JSON, "r") as f:
77
  gallery = json.load(f)
78
+ return [(item["video"], item["prompt"]) for item in reversed(gallery)]
79
  return []
80
 
81
  def update_gallery():
82
+ return load_gallery()
 
 
 
 
83
 
84
  def respond(image, prompt, steps, cfg_scale, eta, fs, seed, video_length):
85
  logging.info(f"Received prompt: {prompt}, steps: {steps}, cfg_scale: {cfg_scale}, "
 
129
  ["A man climbing a rock wall reaching for the next hold", "q25.png"],
130
  ["pov of an austronaut holding a small red rock that has a portal showing the Statue of Liberty, alien landscape of a red planet in the background, surreal","q26.png"],
131
  ["a smartphone product showcase, smartphone display showing immersive wallpaper and time, blurred turquoise background","q27.png"],
132
+ ["A glamorous young woman with long, wavy blonde hair and smokey eye makeup, posing in a luxury hotel room. She's wearing a sparkly gold cocktail dress and holding up a white card with 'openfree.ai' written on it in elegant calligraphy. Soft, warm lighting creates a luxurious atmosphere. ", "q1.webp"],
133
  ["A fit male fitness influencer with short dark hair and stubble, standing shirtless in a modern gym. He has defined abs and arm muscles, and is holding a protein shake in one hand and a card that says 'openfree.ai' in the other. Bright, clean lighting highlights his physique.", "q2.webp"],
134
+ ["A bohemian-style female travel blogger with sun-kissed skin and messy beach waves, sitting on a tropical beach at sunset. She's wearing a flowy white sundress and holding up a weathered postcard with 'openfree.ai' scrawled on it. Golden hour lighting bathes the scene in warm tones. ", "q3.webp"],
135
+ ["A trendy male fashion influencer with perfectly styled hair and designer stubble, posing on a city street. He's wearing a tailored suit and holding up a sleek black business card with 'openfree.ai' printed in minimalist white font. The background shows blurred city lights, creating a chic urban atmosphere.", "q4.webp"],
136
+ ["A fresh-faced young female beauty guru with freckles and natural makeup, sitting at a vanity covered in cosmetics. She's wearing a pastel pink robe and holding up a makeup palette with 'openfree.ai' written on it in lipstick. Soft, flattering lighting enhances her radiant complexion. ", "q5.webp"],
137
+ ["A stylish young woman with long, wavy ombre hair and winged eyeliner, posing in front of a neon-lit city skyline at night. She's wearing a sleek black leather jacket over a sparkly crop top and holding up a holographic business card that says 'openfree.ai' in futuristic font. The card reflects the colorful neon lights, creating a cyberpunk aesthetic.", "q6.webp"],
138
+ ["Create a surreal advertisement poster for a fictional time travel agency. The background should depict a swirling vortex of clock faces and historical landmarks from different eras. In the foreground, place large, bold text that reads "AI TOURS: YOUR PAST IS OUR FUTURE" in a retro-futuristic font. The text should appear to be partially disintegrating into particles that are being sucked into the time vortex. Include smaller text at the bottom with fictional pricing and the slogan "History is just a ticket away!"", "q7.webp"],
139
  ["Photo realistic scene inspired by LOTR: [A tiny red dragon sleeps curled up in a nest on a medieval wizard's table]. Shot with a macro lens (f/2.8, 50mm) and a Canon EOSR5, the soft focus captures [the cozy morning light filtering through a near by window]. The pastel colors and whimsical steam shapes enhance the serene atmosphere, evoking a DnD RPG setting. The image is rendered in 16K and 8K, highlighting [the intricate details and medieval charm].", "q8.webp"],
140
  ["μ¬κΈ€λΌμŠ€λ₯Ό μ°©μš©ν•œ κ·€μ—¬μš΄ κ°•μ•„μ§€κ°€ 'Openfree.ai'라고 μ“°μ—¬μ§„ ν‘œμ§€νŒμ„ λ“€κ³ μžˆλ‹€.", "q9.webp"],
141
  ["미레적인 λ„μ‹œμ˜ ν•΄μ§€λŠ” 풍경", "q10.webp"],
 
151
  ["A fantasy map of a fictional world, with detailed terrain and cities.", "q19.webp"]
152
  ]
153
 
 
154
  def use_prompt_and_image(prompt, image):
155
  return prompt, image
156
 
157
  def show_video(evt: gr.SelectData):
158
+ return evt.value[0] if isinstance(evt.value, tuple) and len(evt.value) > 0 else None
159
 
160
  with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css) as demo:
161
  with gr.Tab("Generate"):
 
195
  columns=[5],
196
  rows=[3],
197
  object_fit="contain",
198
+ height="auto"
 
199
  )
200
  selected_video = gr.Video(label="Selected Video")
201
  refresh_btn = gr.Button("Refresh Gallery")