sabaridsnfuji commited on
Commit
ce08ce0
1 Parent(s): c01ac6d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -103,20 +103,23 @@ analyzer = FloorPlanAnalyzer(model_path=model_path)
103
 
104
  # Sample images for Gradio examples
105
  # Define sample images for user convenience
 
106
  sample_images = [
107
- "./sample/10_2.jpg",
108
- "./sample/10_10.jpg",
109
- "./sample/0_10.jpg",
110
- "./sample/2_12.jpg"
111
  ]
112
 
113
- # Ensure sample images directory exists
114
  os.makedirs("samples", exist_ok=True)
 
115
  # Save some dummy sample images if they don't exist (you should replace these with actual images)
116
  for i, sample in enumerate(sample_images):
117
- if not os.path.exists(sample):
 
118
  img = Image.new("RGB", (224, 224), color=(i * 50, i * 50, i * 50))
119
- img.save(sample)
120
 
121
  # Gradio prediction function
122
  def predict_image(image, instruction):
 
103
 
104
  # Sample images for Gradio examples
105
  # Define sample images for user convenience
106
+ # Define sample images and instructions
107
  sample_images = [
108
+ ["./samples/10_2.jpg", "You are an expert in architecture and interior design. Analyze the floor plan image and describe accurately the key features, room count, layout, and any other important details you observe."],
109
+ ["./samples/10_10.jpg", "You are an expert in architecture and interior design. Analyze the floor plan image and describe accurately the key features, room count, layout, and any other important details you observe."],
110
+ ["./samples/0_10.jpg", "You are an expert in architecture and interior design. Analyze the floor plan image and describe accurately the key features, room count, layout, and any other important details you observe."],
111
+ ["./samples/2_12.jpg", "You are an expert in architecture and interior design. Analyze the floor plan image and describe accurately the key features, room count, layout, and any other important details you observe."]
112
  ]
113
 
114
+ # Ensure samples directory exists
115
  os.makedirs("samples", exist_ok=True)
116
+
117
  # Save some dummy sample images if they don't exist (you should replace these with actual images)
118
  for i, sample in enumerate(sample_images):
119
+ image_path = sample[0]
120
+ if not os.path.exists(image_path):
121
  img = Image.new("RGB", (224, 224), color=(i * 50, i * 50, i * 50))
122
+ img.save(image_path)
123
 
124
  # Gradio prediction function
125
  def predict_image(image, instruction):