Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
"./
|
| 108 |
-
"./
|
| 109 |
-
"./
|
| 110 |
-
"./
|
| 111 |
]
|
| 112 |
|
| 113 |
-
# Ensure
|
| 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 |
-
|
|
|
|
| 118 |
img = Image.new("RGB", (224, 224), color=(i * 50, i * 50, i * 50))
|
| 119 |
-
img.save(
|
| 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):
|