File size: 824 Bytes
08bacf4 de57008 4a07312 08bacf4 72ecf70 08bacf4 10b0e75 4a07312 10b0e75 72ecf70 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
import requests
import time
import os
import gradio as gr
from threading import Thread
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))
def placeholder(dummy):
return "lol"
t = Thread(target=warmer)
t.start()
iface = gr.Interface(fn=placeholder, inputs="text", outputs="text")
iface.launch()
|