|
import requests |
|
import time |
|
import os |
|
import gradio as gr |
|
|
|
print("RAN") |
|
hf_token_id = os.environ['TOKEN'] |
|
bearer_hf_token = "Bearer "+hf_token_id |
|
|
|
headers = {"Authorization" : bearer_hf_token} |
|
def warmer(): |
|
while True: |
|
try: |
|
response = requests.get('https://reverent-atlei2.hf.space/', headers=headers) |
|
print(int(response.status_code)) |
|
if response.status_code == 200: |
|
print("ALIVE") |
|
else: |
|
print("DISCONNECTED") |
|
time.sleep(300) |
|
except Exception as e: |
|
print("NO INTERNET") |
|
print(str(e)) |
|
|
|
iface = gr.Interface(fn=warmer, inputs=["text"], outputs=["text"]) |
|
iface.launch() |
|
|