Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
import
|
2 |
import time
|
3 |
import os
|
4 |
import gradio as gr
|
@@ -6,19 +6,21 @@ from threading import Thread
|
|
6 |
|
7 |
print("RAN")
|
8 |
hf_token_id = os.environ['TOKEN']
|
9 |
-
bearer_hf_token = "Bearer "+hf_token_id
|
10 |
|
11 |
-
|
12 |
def warmer():
|
13 |
while True:
|
14 |
try:
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
18 |
print("ALIVE")
|
19 |
else:
|
20 |
print("DISCONNECTED")
|
21 |
-
time.sleep(
|
22 |
except Exception as e:
|
23 |
print("NO INTERNET")
|
24 |
print(str(e))
|
|
|
1 |
+
from gradio_client import Client
|
2 |
import time
|
3 |
import os
|
4 |
import gradio as gr
|
|
|
6 |
|
7 |
print("RAN")
|
8 |
hf_token_id = os.environ['TOKEN']
|
|
|
9 |
|
10 |
+
client = Client("https://reverent-atlei2.hf.space/",hf_token=hf_token_id)
|
11 |
def warmer():
|
12 |
while True:
|
13 |
try:
|
14 |
+
text_output = client.predict(
|
15 |
+
"ATLEIwarm0001", # str in 'message' Textbox component
|
16 |
+
"", # str (filepath or URL to image) in 'Upload any Image' Image component
|
17 |
+
api_name="/predict"
|
18 |
+
)
|
19 |
+
if text_output != None:
|
20 |
print("ALIVE")
|
21 |
else:
|
22 |
print("DISCONNECTED")
|
23 |
+
time.sleep(300)
|
24 |
except Exception as e:
|
25 |
print("NO INTERNET")
|
26 |
print(str(e))
|