Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -197,18 +197,23 @@ class App:
|
|
| 197 |
|
| 198 |
def build_app(self):
|
| 199 |
with gr.Blocks() as demo:
|
|
|
|
| 200 |
for component in self.app_state["components"]:
|
| 201 |
component_type = component["type"]
|
| 202 |
properties = component["properties"]
|
| 203 |
|
| 204 |
if component_type == "Button":
|
| 205 |
-
gr.Button(value=properties["label"], variant="primary")
|
|
|
|
| 206 |
elif component_type == "Text Input":
|
| 207 |
-
gr.Textbox(label=properties["placeholder"])
|
|
|
|
| 208 |
elif component_type == "Image":
|
| 209 |
-
gr.Image(label=properties["alt"])
|
|
|
|
| 210 |
elif component_type == "Dropdown":
|
| 211 |
-
gr.Dropdown(choices=properties["choices"], label="Dropdown")
|
|
|
|
| 212 |
|
| 213 |
with gr.Tab("Terminal"):
|
| 214 |
gr.Markdown("## Terminal")
|
|
|
|
| 197 |
|
| 198 |
def build_app(self):
|
| 199 |
with gr.Blocks() as demo:
|
| 200 |
+
self.components = [] # Store component objects
|
| 201 |
for component in self.app_state["components"]:
|
| 202 |
component_type = component["type"]
|
| 203 |
properties = component["properties"]
|
| 204 |
|
| 205 |
if component_type == "Button":
|
| 206 |
+
button = gr.Button(value=properties["label"], variant="primary")
|
| 207 |
+
self.components.append(button) # Store the button object
|
| 208 |
elif component_type == "Text Input":
|
| 209 |
+
textbox = gr.Textbox(label=properties["placeholder"])
|
| 210 |
+
self.components.append(textbox)
|
| 211 |
elif component_type == "Image":
|
| 212 |
+
image = gr.Image(label=properties["alt"])
|
| 213 |
+
self.components.append(image)
|
| 214 |
elif component_type == "Dropdown":
|
| 215 |
+
dropdown = gr.Dropdown(choices=properties["choices"], label="Dropdown")
|
| 216 |
+
self.components.append(dropdown)
|
| 217 |
|
| 218 |
with gr.Tab("Terminal"):
|
| 219 |
gr.Markdown("## Terminal")
|