Spaces:
Sleeping
Sleeping
File size: 668 Bytes
99dd718 8ce96e2 99dd718 a44ca03 14c2c0e a44ca03 8ce96e2 14c2c0e 8ce96e2 a44ca03 8ce96e2 a44ca03 99dd718 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | import gradio as gr
import os
from MLStructFP.db import DbLoader
# Path to the sample data (adjust if needed)
DB_PATH = os.path.join(os.path.dirname(__file__), "test", "data", "fp.json")
# Load the database once
db = DbLoader(DB_PATH)
def get_floor_ids():
return [f.id for f in db.floors]
def plot_floor(floor_id):
floor = db[floor_id]
fig = floor.plot_basic()
return fig
with gr.Blocks() as demo:
gr.Markdown("# MLStructFP Floor Plan Demo")
floor_id = gr.Dropdown(choices=get_floor_ids(), label="Select Floor ID")
plot = gr.Plot(label="Floor Plan Plot")
floor_id.change(fn=plot_floor, inputs=floor_id, outputs=plot)
demo.launch() |