Abdulrahman1989 commited on
Commit
5f35729
·
1 Parent(s): 724d8ef

Fix app.py for display the gr.Textbox at the top and align the gr.Image and gr.Video side by side at the bottom:

Browse files
Files changed (1) hide show
  1. app.py +7 -10
app.py CHANGED
@@ -7,11 +7,6 @@ from Image3DProcessor import Image3DProcessor # Import your 3D processing class
7
  from PIL import Image
8
  import io
9
 
10
- class ControlNetProcessor:
11
- def controlnet_image(self, image):
12
- # Placeholder for ControlNet processing (e.g., returning a processed image or placeholder text)
13
- return image # Returning the image for further processing
14
-
15
  class VideoGenerator:
16
  def __init__(self, model_cfg_path, model_repo_id, model_filename):
17
  # Initialize the Image3DProcessor
@@ -27,7 +22,6 @@ class VideoGenerator:
27
  class GradioApp:
28
  def __init__(self):
29
  self.sdxl_generator = SDXLImageGenerator() # Use your existing class
30
- self.controlnet_processor = ControlNetProcessor()
31
  # Initialize VideoGenerator with required paths and details
32
  self.video_generator = VideoGenerator(
33
  model_cfg_path="/home/user/app/splatter-image/gradio_config.yaml",
@@ -36,9 +30,10 @@ class GradioApp:
36
  )
37
 
38
  def full_pipeline(self, prompt):
39
-
40
  initial_image = self.sdxl_generator.generate_images([prompt])[0]
41
 
 
42
  video_data = self.video_generator.generate_3d_video(initial_image)
43
 
44
  with tempfile.NamedTemporaryFile(delete=False, suffix=".mp4") as video_file:
@@ -54,11 +49,13 @@ class GradioApp:
54
  with gr.Blocks() as interface:
55
  gr.Textbox(label="Input Prompt", elem_id="input_textbox")
56
  with gr.Row():
 
57
  gr.Image(label="Generated Image", elem_id="generated_image")
 
58
  gr.Video(label="3D Model Video", elem_id="model_video")
59
- interface.launch(share=True)
60
-
61
 
62
  if __name__ == "__main__":
63
  app = GradioApp()
64
- app.launch()
 
7
  from PIL import Image
8
  import io
9
 
 
 
 
 
 
10
  class VideoGenerator:
11
  def __init__(self, model_cfg_path, model_repo_id, model_filename):
12
  # Initialize the Image3DProcessor
 
22
  class GradioApp:
23
  def __init__(self):
24
  self.sdxl_generator = SDXLImageGenerator() # Use your existing class
 
25
  # Initialize VideoGenerator with required paths and details
26
  self.video_generator = VideoGenerator(
27
  model_cfg_path="/home/user/app/splatter-image/gradio_config.yaml",
 
30
  )
31
 
32
  def full_pipeline(self, prompt):
33
+ # Generate the initial image using SDXLImageGenerator
34
  initial_image = self.sdxl_generator.generate_images([prompt])[0]
35
 
36
+ # Generate a 3D video using the image
37
  video_data = self.video_generator.generate_3d_video(initial_image)
38
 
39
  with tempfile.NamedTemporaryFile(delete=False, suffix=".mp4") as video_file:
 
49
  with gr.Blocks() as interface:
50
  gr.Textbox(label="Input Prompt", elem_id="input_textbox")
51
  with gr.Row():
52
+ gr.Column(scale=1, min_width=300) # Adjusts column width for the image
53
  gr.Image(label="Generated Image", elem_id="generated_image")
54
+ gr.Column(scale=1, min_width=300) # Adjusts column width for the video
55
  gr.Video(label="3D Model Video", elem_id="model_video")
56
+
57
+ interface.launch(share=True)
58
 
59
  if __name__ == "__main__":
60
  app = GradioApp()
61
+ app.launch()