OnlyCheeini commited on
Commit
69b7b38
1 Parent(s): ff37d54

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -29
app.py CHANGED
@@ -1,33 +1,7 @@
1
  import gradio as gr
2
- import subprocess
3
 
 
 
4
 
5
-
6
- def get_ip(space_url):
7
- try:
8
- # Use the ping command to get the IP address
9
- result = subprocess.run(["ping", "-c", "1", space_url], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
10
- output = result.stdout
11
-
12
- # Extract the IP address from the output
13
- start = output.find("(") + 1
14
- end = output.find(")")
15
- ip_address = output[start:end]
16
-
17
- if not ip_address:
18
- return "Failed to retrieve IP address."
19
-
20
- return ip_address
21
- except Exception as e:
22
- return str(e)
23
-
24
- # Gradio interface
25
- iface = gr.Interface(
26
- fn=get_ip,
27
- inputs="text",
28
- outputs="text",
29
- title="Get Hugging Face Space IP Address",
30
- description="Enter the URL of your Hugging Face Space (e.g., your-space-url.hf.space) to retrieve its IP address."
31
- )
32
-
33
  iface.launch()
 
1
  import gradio as gr
 
2
 
3
+ def greet(name, req: gr.Request):
4
+ return f"{req.headers=}"
5
 
6
+ iface = gr.Interface(fn=greet, inputs="text", outputs="text")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  iface.launch()