pngwn HF staff commited on
Commit
fb42686
·
verified ·
1 Parent(s): e08a364

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -10
app.py CHANGED
@@ -23,10 +23,13 @@ app.add_middleware(
23
  allow_headers=["*"],
24
  )
25
 
26
- # Create a simple Gradio interface
27
- def greet(name):
28
- return f"Hello, {name}!"
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
- i = 0
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