Abdulrahman1989 commited on
Commit
ad5cb25
·
1 Parent(s): 343346a

Update main app to class SDXLImageGenerator class

Browse files
Files changed (1) hide show
  1. app.py +4 -8
app.py CHANGED
@@ -1,11 +1,7 @@
1
  import gradio as gr
2
  import tempfile
3
  import os
4
-
5
- class SDXLGenerator:
6
- def generate_image(self, prompt):
7
- # Placeholder for image generation (e.g., returning a sample image or placeholder text)
8
- return "Placeholder for Generated Image"
9
 
10
  class ControlNetProcessor:
11
  def controlnet_image(self, image):
@@ -27,12 +23,12 @@ class VideoGenerator:
27
 
28
  class GradioApp:
29
  def __init__(self):
30
- self.sdxl_generator = SDXLGenerator()
31
  self.controlnet_processor = ControlNetProcessor()
32
  self.video_generator = VideoGenerator()
33
 
34
  def full_pipeline(self, prompt):
35
- initial_image = self.sdxl_generator.generate_image(prompt)
36
  controlled_image = self.controlnet_processor.controlnet_image(initial_image)
37
  video_path = self.video_generator.generate_3d_video(controlled_image)
38
  return initial_image, controlled_image, video_path
@@ -42,7 +38,7 @@ class GradioApp:
42
  fn=self.full_pipeline,
43
  inputs=gr.Textbox(label="Input Prompt"),
44
  outputs=[
45
- gr.Textbox(label="Generated Image Placeholder"),
46
  gr.Textbox(label="ControlNet Output Image Placeholder"),
47
  gr.Video(label="3D Model Video")
48
  ],
 
1
  import gradio as gr
2
  import tempfile
3
  import os
4
+ from SDXLImageGenerator import SDXLImageGenerator # Import your existing class
 
 
 
 
5
 
6
  class ControlNetProcessor:
7
  def controlnet_image(self, image):
 
23
 
24
  class GradioApp:
25
  def __init__(self):
26
+ self.sdxl_generator = SDXLImageGenerator() # Use your existing class
27
  self.controlnet_processor = ControlNetProcessor()
28
  self.video_generator = VideoGenerator()
29
 
30
  def full_pipeline(self, prompt):
31
+ initial_image = self.sdxl_generator.generate_images([prompt])[0]
32
  controlled_image = self.controlnet_processor.controlnet_image(initial_image)
33
  video_path = self.video_generator.generate_3d_video(controlled_image)
34
  return initial_image, controlled_image, video_path
 
38
  fn=self.full_pipeline,
39
  inputs=gr.Textbox(label="Input Prompt"),
40
  outputs=[
41
+ gr.Image(label="Generated Image"),
42
  gr.Textbox(label="ControlNet Output Image Placeholder"),
43
  gr.Video(label="3D Model Video")
44
  ],