AZLABS commited on
Commit
62ead92
Β·
verified Β·
1 Parent(s): 885164c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -65
app.py CHANGED
@@ -48,7 +48,7 @@ class Text2Video:
48
  LOGGER.info(f"πŸ”„ Sending request to Hercai API...")
49
 
50
  image_result = self.herc.draw_image(
51
- model="simurg",
52
  prompt=comic_style_prompt,
53
  negative_prompt="blurry, cropped, low quality, dark, gloomy"
54
  )
@@ -209,89 +209,30 @@ class Text2Video:
209
  LOGGER.error(f"❌ Error in video generation: {str(e)}")
210
  raise
211
 
212
-
213
  def gradio_interface(self):
214
  """Create Gradio interface."""
215
  LOGGER.info("🌐 Initializing Gradio interface")
216
 
217
- # Example stories of different lengths
218
- short_story = """A little bird found a shiny seed,,
219
- The bird planted it in the garden,,
220
- The next day, a magical flower grew,,
221
- The bird and flower became best friends"""
222
-
223
- medium_story = """In a bustling city, a lonely robot worked in a toy shop,,
224
- Every night, the robot would fix broken toys while everyone slept,,
225
- One day, a little girl noticed the robot's kindness,,
226
- She started leaving thank you notes for the robot,,
227
- The robot began making special toys just for her,,
228
- Soon, other children discovered the robot's magical toys,,
229
- The toy shop became famous for its special toys,,
230
- The robot wasn't lonely anymore, surrounded by happy children"""
231
-
232
- long_story = """Deep in the enchanted forest, there lived a young wizard named Leo who couldn't control his magic,,
233
- Every time Leo tried to cast a spell, unexpected things would happen - flowers turned into butterflies, rain became candy, and his cat could suddenly speak French,,
234
- One day, Leo discovered an ancient book hidden beneath a talking tree,,
235
- The book revealed that his 'mistakes' were actually rare gifts - the ability to bring joy and wonder to the world,,
236
- Excited about his discovery, Leo started practicing his unique magic in secret,,
237
- He created a garden where flowers sang lullabies,,
238
- He made clouds that rained rainbow bubbles,,
239
- He transformed ordinary objects into extraordinary treasures,,
240
- Word spread about the magical happenings in the forest,,
241
- Children from nearby villages would visit to see Leo's wonderful creations,,
242
- Adults who had forgotten about magic began to believe again,,
243
- The forest became a place of wonder and happiness,,
244
- Leo realized that sometimes the best magic comes from embracing what makes you different,,
245
- And so, the once-frustrated wizard became known as Leo the Wonderful, master of joyful surprises"""
246
-
247
  with gr.Blocks(theme='abidlabs/dracula_revamped') as demo:
248
  gr.HTML("""
249
  <center><h1 style="color:#fff">Comic Video Generator</h1></center>
250
- <center><p style="color:#ccc">Create animated comics from your stories! Separate scenes with double commas (,,)</p></center>
251
  """)
252
 
253
  with gr.Row():
254
  input_text = gr.Textbox(
255
  label="Comic Script",
256
- placeholder="Enter your story (separate scenes with ,,)",
257
- lines=5
258
  )
259
 
260
  with gr.Row():
261
- generate_btn = gr.Button("🎬 Generate Video", variant="primary")
262
 
263
  with gr.Row():
264
  output = gr.Video(label="Generated Comic Video")
265
 
266
- # Examples section with three stories
267
- gr.Examples(
268
- examples=[
269
- [short_story],
270
- [medium_story],
271
- [long_story]
272
- ],
273
- inputs=[input_text],
274
- label="Story Examples",
275
- headers=[
276
- "Short Story (4 scenes)",
277
- "Medium Story (8 scenes)",
278
- "Long Story (14 scenes)"
279
- ]
280
- )
281
-
282
- # Add some helpful tips
283
- gr.HTML("""
284
- <div style="color:#ccc; padding: 20px; margin-top: 20px; background: rgba(0,0,0,0.1); border-radius: 10px;">
285
- <h3>Tips for Better Results:</h3>
286
- <ul>
287
- <li>Separate each scene with double commas (,,)</li>
288
- <li>Keep each scene description clear and vivid</li>
289
- <li>Include character emotions and actions</li>
290
- <li>Describe the setting and atmosphere</li>
291
- <li>Aim for 3-15 scenes for best results</li>
292
- </ul>
293
- </div>
294
- """)
295
 
296
  generate_btn.click(self.generate_video, inputs=[input_text], outputs=[output])
297
 
 
48
  LOGGER.info(f"πŸ”„ Sending request to Hercai API...")
49
 
50
  image_result = self.herc.draw_image(
51
+ model="v3",
52
  prompt=comic_style_prompt,
53
  negative_prompt="blurry, cropped, low quality, dark, gloomy"
54
  )
 
209
  LOGGER.error(f"❌ Error in video generation: {str(e)}")
210
  raise
211
 
 
212
  def gradio_interface(self):
213
  """Create Gradio interface."""
214
  LOGGER.info("🌐 Initializing Gradio interface")
215
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
  with gr.Blocks(theme='abidlabs/dracula_revamped') as demo:
217
  gr.HTML("""
218
  <center><h1 style="color:#fff">Comic Video Generator</h1></center>
 
219
  """)
220
 
221
  with gr.Row():
222
  input_text = gr.Textbox(
223
  label="Comic Script",
224
+ placeholder="Enter your story (separate scenes with ,,)"
 
225
  )
226
 
227
  with gr.Row():
228
+ generate_btn = gr.Button("🎬 Generate Video")
229
 
230
  with gr.Row():
231
  output = gr.Video(label="Generated Comic Video")
232
 
233
+ # Example text
234
+ example_txt = """Once upon a time in a magical forest,, A brave knight discovered a mysterious crystal,, The crystal began to glow with incredible power"""
235
+ gr.Examples([[example_txt]], [input_text])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
 
237
  generate_btn.click(self.generate_video, inputs=[input_text], outputs=[output])
238