rawanessam commited on
Commit
99dd718
·
verified ·
1 Parent(s): 4d4b74b

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from MLStructFP import DbLoader
3
+ import os
4
+
5
+ def visualize_floor_plan(json_path):
6
+ """Load and visualize a floor plan from the dataset."""
7
+ try:
8
+ db = DbLoader(json_path)
9
+ summary = db.tabulate() # Get a summary of the dataset
10
+ return summary
11
+ except Exception as e:
12
+ return f"Error: {str(e)}"
13
+
14
+ # Gradio Interface
15
+ demo = gr.Interface(
16
+ fn=visualize_floor_plan,
17
+ inputs=gr.File(label="Upload `fp.json` from MLSTRUCT-FP"),
18
+ outputs=gr.Textbox(label="Dataset Summary"),
19
+ title="MLSTRUCT-FP: Floor Plan Dataset Viewer",
20
+ description="Upload `fp.json` to visualize floor plan data.",
21
+ examples=[["test/data/fp.json"]] # Optional: Add example file
22
+ )
23
+
24
+ demo.launch()