kevalfst commited on
Commit
357e4ab
·
verified ·
1 Parent(s): 4b17c2f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -9
app.py CHANGED
@@ -66,28 +66,32 @@ def generate_video_from_image(image):
66
  frames = IMG2VID_PIPE(image, num_inference_steps=16).frames[0]
67
  return export_to_video(frames, "svd_video.mp4", fps=8)
68
 
69
- with gr.Blocks() as demo:
70
  gr.Markdown("# 🧠 Lightweight Any‑to‑Any AI Playground")
71
-
72
  with gr.Tab("Text → Image"):
73
  inp = gr.Textbox(label="Prompt")
74
  out = gr.Image()
75
- gr.Button("Generate").click(generate_image_from_text, inp, out)
76
-
 
77
  with gr.Tab("Image → Image"):
78
  img = gr.Image(label="Input Image")
79
  prm = gr.Textbox(label="Edit Prompt")
80
  out2 = gr.Image()
81
- gr.Button("Generate").click(generate_image_from_image_and_prompt, [img, prm], out2)
82
-
 
83
  with gr.Tab("Text → Video"):
84
  inp2 = gr.Textbox(label="Prompt")
85
  out_vid = gr.Video()
86
- gr.Button("Generate").click(generate_video_from_text, inp2, out_vid)
87
-
 
88
  with gr.Tab("Image → Video"):
89
  img2 = gr.Image(label="Input Image")
90
  out_vid2 = gr.Video()
91
- gr.Button("Animate").click(generate_video_from_image, img2, out_vid2)
 
92
 
93
  demo.launch()
 
66
  frames = IMG2VID_PIPE(image, num_inference_steps=16).frames[0]
67
  return export_to_video(frames, "svd_video.mp4", fps=8)
68
 
69
+ with gr.Blocks(theme=gr.themes.Soft()) as demo:
70
  gr.Markdown("# 🧠 Lightweight Any‑to‑Any AI Playground")
71
+
72
  with gr.Tab("Text → Image"):
73
  inp = gr.Textbox(label="Prompt")
74
  out = gr.Image()
75
+ btn = gr.Button("Generate")
76
+ btn.click(generate_image_from_text, inp, out)
77
+
78
  with gr.Tab("Image → Image"):
79
  img = gr.Image(label="Input Image")
80
  prm = gr.Textbox(label="Edit Prompt")
81
  out2 = gr.Image()
82
+ btn2 = gr.Button("Generate")
83
+ btn2.click(generate_image_from_image_and_prompt, [img, prm], out2)
84
+
85
  with gr.Tab("Text → Video"):
86
  inp2 = gr.Textbox(label="Prompt")
87
  out_vid = gr.Video()
88
+ btn3 = gr.Button("Generate")
89
+ btn3.click(generate_video_from_text, inp2, out_vid)
90
+
91
  with gr.Tab("Image → Video"):
92
  img2 = gr.Image(label="Input Image")
93
  out_vid2 = gr.Video()
94
+ btn4 = gr.Button("Animate")
95
+ btn4.click(generate_video_from_image, img2, out_vid2)
96
 
97
  demo.launch()