Update app.py
Browse files
app.py
CHANGED
|
@@ -7,16 +7,19 @@ hf_token_id = os.environ['TOKEN']
|
|
| 7 |
bearer_hf_token = "Bearer "+hf_token_id
|
| 8 |
|
| 9 |
headers = {"Authorization" : bearer_hf_token}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
response = requests.get('https://reverent-atlei2.hf.space/', headers=headers)
|
| 14 |
-
print(int(response.status_code))
|
| 15 |
-
if response.status_code == 200:
|
| 16 |
-
print("ALIVE")
|
| 17 |
-
else:
|
| 18 |
-
print("DISCONNECTED")
|
| 19 |
-
time.sleep(300)
|
| 20 |
-
except Exception as e:
|
| 21 |
-
print("NO INTERNET")
|
| 22 |
-
print(str(e))
|
|
|
|
| 7 |
bearer_hf_token = "Bearer "+hf_token_id
|
| 8 |
|
| 9 |
headers = {"Authorization" : bearer_hf_token}
|
| 10 |
+
def warmer():
|
| 11 |
+
while True:
|
| 12 |
+
try:
|
| 13 |
+
response = requests.get('https://reverent-atlei2.hf.space/', headers=headers)
|
| 14 |
+
print(int(response.status_code))
|
| 15 |
+
if response.status_code == 200:
|
| 16 |
+
print("ALIVE")
|
| 17 |
+
else:
|
| 18 |
+
print("DISCONNECTED")
|
| 19 |
+
time.sleep(300)
|
| 20 |
+
except Exception as e:
|
| 21 |
+
print("NO INTERNET")
|
| 22 |
+
print(str(e))
|
| 23 |
|
| 24 |
+
iface = gr.Interface(fn=warmer, inputs=["text"], outputs=["text"])
|
| 25 |
+
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|