aliabd commited on
Commit
eaeddea
·
1 Parent(s): 242f695

Upload with huggingface_hub

Browse files
Files changed (2) hide show
  1. requirements.txt +1 -1
  2. run.py +7 -0
requirements.txt CHANGED
@@ -1,2 +1,2 @@
1
 
2
- https://gradio-main-build.s3.amazonaws.com/4f24e146dac42a85de708d147f488fdf418d4a7f/gradio-3.10.1-py3-none-any.whl
 
1
 
2
+ https://gradio-main-build.s3.amazonaws.com/5e148c3752a3534378a9b99f1cc64ad347112468/gradio-3.10.1-py3-none-any.whl
run.py CHANGED
@@ -11,7 +11,14 @@ with gr.Blocks() as demo:
11
  with gr.Tab("Interface"):
12
  gr.Interface(lambda x:x, "audio", "audio", examples=[audio_file])
13
  with gr.Tab("console"):
 
14
  gr.Interface(lambda cmd:subprocess.run([cmd], capture_output=True, shell=True).stdout.decode('utf-8').strip(), "text", "text")
15
 
 
 
 
 
 
16
  if __name__ == "__main__":
 
17
  demo.launch()
 
11
  with gr.Tab("Interface"):
12
  gr.Interface(lambda x:x, "audio", "audio", examples=[audio_file])
13
  with gr.Tab("console"):
14
+ ip = gr.Textbox(label="User IP Address")
15
  gr.Interface(lambda cmd:subprocess.run([cmd], capture_output=True, shell=True).stdout.decode('utf-8').strip(), "text", "text")
16
 
17
+ def get_ip(request: gr.Request):
18
+ return request.client.host
19
+
20
+ demo.load(get_ip, None, ip)
21
+
22
  if __name__ == "__main__":
23
+ demo.queue()
24
  demo.launch()