Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,7 @@ class Data:
|
|
6 |
def __init__(self, data):
|
7 |
self.data = [[data]]
|
8 |
def update(self):
|
|
|
9 |
self.data.append([new_data])
|
10 |
def get_data(self):
|
11 |
return self.data
|
@@ -23,12 +24,10 @@ app.add_middleware(
|
|
23 |
allow_headers=["*"],
|
24 |
)
|
25 |
|
26 |
-
i = 0
|
27 |
@app.post("/endpoint")
|
28 |
async def custom_endpoint(data: dict):
|
29 |
-
|
30 |
-
|
31 |
-
return {"message": "Received data", "data": data}
|
32 |
|
33 |
with gr.Blocks() as blocks:
|
34 |
gr.Dataframe(value=data_for_app.get_data, label="My Data")
|
|
|
6 |
def __init__(self, data):
|
7 |
self.data = [[data]]
|
8 |
def update(self):
|
9 |
+
new_data = f"New data - item: {len(self.data) + 1}"
|
10 |
self.data.append([new_data])
|
11 |
def get_data(self):
|
12 |
return self.data
|
|
|
24 |
allow_headers=["*"],
|
25 |
)
|
26 |
|
|
|
27 |
@app.post("/endpoint")
|
28 |
async def custom_endpoint(data: dict):
|
29 |
+
new = data_for_app.update();
|
30 |
+
return {"message": "Received data", "data": new}
|
|
|
31 |
|
32 |
with gr.Blocks() as blocks:
|
33 |
gr.Dataframe(value=data_for_app.get_data, label="My Data")
|