Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -7,26 +7,36 @@ def send_dummy_request(space_url):
|
|
7 |
try:
|
8 |
response = requests.get(space_url)
|
9 |
# Print the response status code (optional)
|
10 |
-
print(f"Response Status Code: {response.status_code}")
|
11 |
except Exception as e:
|
12 |
print(f"Error: {e}")
|
13 |
|
14 |
-
def
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
try:
|
16 |
while True:
|
17 |
send_dummy_request(space_url)
|
|
|
18 |
time.sleep(interval_seconds)
|
19 |
except KeyboardInterrupt:
|
20 |
print("Background script terminated by user.")
|
21 |
|
22 |
# Replace 'YOUR_SPACE_URL' with the actual URL of your deployed Hugging Face Space
|
23 |
space_url = 'https://huggingface.co/spaces/clone3/Wait'
|
|
|
24 |
|
25 |
# Set the interval for sending requests (in seconds)
|
26 |
interval_seconds = 1800 # 30 minutes
|
27 |
|
28 |
# Start the background thread
|
29 |
-
background_thread = threading.Thread(target=background_request, args=(space_url, interval_seconds))
|
30 |
background_thread.start()
|
31 |
|
32 |
# Gradio interface
|
|
|
7 |
try:
|
8 |
response = requests.get(space_url)
|
9 |
# Print the response status code (optional)
|
10 |
+
print(f"Response Status Code Of Wait: {response.status_code}")
|
11 |
except Exception as e:
|
12 |
print(f"Error: {e}")
|
13 |
|
14 |
+
def send_dummy_request_self(space_url_self):
|
15 |
+
try:
|
16 |
+
response = requests.get(space_url_self)
|
17 |
+
# Print the response status code (optional)
|
18 |
+
print(f"Response Status Code Of Self: {response.status_code}")
|
19 |
+
except Exception as e:
|
20 |
+
print(f"Error: {e}")
|
21 |
+
|
22 |
+
def background_request(space_url,space_url_self, interval_seconds):
|
23 |
try:
|
24 |
while True:
|
25 |
send_dummy_request(space_url)
|
26 |
+
send_dummy_request(space_url_self)
|
27 |
time.sleep(interval_seconds)
|
28 |
except KeyboardInterrupt:
|
29 |
print("Background script terminated by user.")
|
30 |
|
31 |
# Replace 'YOUR_SPACE_URL' with the actual URL of your deployed Hugging Face Space
|
32 |
space_url = 'https://huggingface.co/spaces/clone3/Wait'
|
33 |
+
space_url_self = 'https://huggingface.co/spaces/clone3/Sender'
|
34 |
|
35 |
# Set the interval for sending requests (in seconds)
|
36 |
interval_seconds = 1800 # 30 minutes
|
37 |
|
38 |
# Start the background thread
|
39 |
+
background_thread = threading.Thread(target=background_request, args=(space_url,space_url_self, interval_seconds))
|
40 |
background_thread.start()
|
41 |
|
42 |
# Gradio interface
|