radames commited on
Commit
71f7514
1 Parent(s): 3934dd2

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import socket
3
+
4
+ def detect(text, request: gr.Request):
5
+ client_ip = request.client.host
6
+ local_ip = socket.gethostbyname(socket.gethostname())
7
+ return text, {"client_ip": client_ip, "local_ip": local_ip}
8
+
9
+ with gr.Blocks() as demo:
10
+ gr.Markdown("## Test request")
11
+ text = gr.Textbox(label="dummy input")
12
+ output = JSON({})
13
+ btn = gr.Button("Test")
14
+
15
+ btn.click(predict, inputs=[text],outputs=[text, output])
16
+
17
+
18
+ block.launch(share=False, server_name='0.0.0.0')