Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -23,10 +23,13 @@ app.add_middleware(
|
|
23 |
allow_headers=["*"],
|
24 |
)
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
30 |
with gr.Blocks() as blocks:
|
31 |
gr.Dataframe(value=data_for_app.get_data, label="My Data")
|
32 |
|
@@ -34,12 +37,7 @@ with gr.Blocks() as blocks:
|
|
34 |
app = gr.mount_gradio_app(app, blocks, path="/", ssr_mode=False)
|
35 |
|
36 |
# Custom POST endpoint
|
37 |
-
|
38 |
-
@app.post("/endpoint")
|
39 |
-
async def custom_endpoint(data: dict):
|
40 |
-
i = i + 1
|
41 |
-
data_for_app.update(f"New data - item: {i}");
|
42 |
-
return {"message": "Received data", "data": data}
|
43 |
|
44 |
if __name__ == "__main__":
|
45 |
import uvicorn
|
|
|
23 |
allow_headers=["*"],
|
24 |
)
|
25 |
|
26 |
+
i = 0
|
27 |
+
@app.post("/endpoint")
|
28 |
+
async def custom_endpoint(data: dict):
|
29 |
+
i = i + 1
|
30 |
+
data_for_app.update(f"New data - item: {i}");
|
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")
|
35 |
|
|
|
37 |
app = gr.mount_gradio_app(app, blocks, path="/", ssr_mode=False)
|
38 |
|
39 |
# Custom POST endpoint
|
40 |
+
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
if __name__ == "__main__":
|
43 |
import uvicorn
|