fantaxy commited on
Commit
50e7ded
ยท
verified ยท
1 Parent(s): be37ec2

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +67 -0
app.py ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ import time
3
+ import sched
4
+ from datetime import datetime
5
+
6
+ # ์Šค์ผ€์ค„๋Ÿฌ ์ดˆ๊ธฐํ™”
7
+ s = sched.scheduler(time.time, time.sleep)
8
+
9
+ # URL ๋ฆฌ์ŠคํŠธ (์ด 100๊ฐœ์˜ URL์ด ์žˆ๋‹ค๊ณ  ๊ฐ€์ •)
10
+ urls = [
11
+ "https://ginipick-gini-llm-chatbot-text.hf.space",
12
+ "https://ginipick-gini-llm-chat-speech.hf.space",
13
+ "https://ginipick-gini-llm-blog.hf.space",
14
+ "https://fantaxy-kai-chat-speech.hf.space",
15
+ "https://fantaxy-kai-tts.hf.space",
16
+ "https://fantaxy-kai-ytb-audio.hf.space",
17
+ "https://fantaxy-kai-ytb-blog.hf.space",
18
+ "https://fantaxy-kai-girlfriend19.hf.space",
19
+ "https://fantaxy-kai-person-lee.hf.space",
20
+ "https://fantaxy-kai-person-jobs.hf.space",
21
+ "https://fantaxy-kai-person-eins.hf.space",
22
+ "https://fantaxy-kai-person-musk.hf.space",
23
+ "https://fantaxy-kai-person-hwang.hf.space",
24
+ "https://ginipick-kai-commu-1253181171853164544.hf.space",
25
+ "https://ginipick-kai-commu-1253181193180942367.hf.space",
26
+ "https://ginipick-kai-commu-1253181238676557884.hf.space",
27
+ "https://ginipick-kai-commu-1253181258561884161.hf.space",
28
+ "https://ginipick-kai-commu-1253181305739411567.hf.space",
29
+ "https://ginipick-kai-commu-1253181326060949585.hf.space",
30
+ "https://ginipick-kai-commu-1253181359371980892.hf.space",
31
+ "https://ginipick-kai-commu-1253181380091973715.hf.space",
32
+ "https://ginipick-kai-commu-1253181427605045329.hf.space",
33
+ "https://ginipick-kai-commu-1253181449008320553.hf.space",
34
+ "https://ginipick-kai-commu-1253181487818211348.hf.space",
35
+ "https://ginipick-kai-commu-1253181517593837568.hf.space",
36
+ "https://ginipick-kai-commu-1253181557233946665.hf.space",
37
+ "https://ginipick-kai-commu-1253181575252803634.hf.space",
38
+ "https://ginipick-kai-commu-1253181626750341141.hf.space"
39
+ # ์—ฌ๊ธฐ์— ์ถ”๊ฐ€ URL์„ ์ถ”๊ฐ€ํ•˜์„ธ์š”
40
+ ]
41
+
42
+ # URL์— ์ ‘์†์„ ์‹œ๋„ํ•˜๋Š” ํ•จ์ˆ˜
43
+ def check_url(url):
44
+ try:
45
+ response = requests.get(url)
46
+ status = response.status_code
47
+ print(f"{datetime.now()}: {url} - ์ƒํƒœ ์ฝ”๋“œ: {status}")
48
+ except requests.RequestException as e:
49
+ print(f"{datetime.now()}: {url} - ์˜ค๋ฅ˜: {e}")
50
+
51
+ # ๋ชจ๋“  URL์„ ์ฒดํฌํ•˜๋Š” ํ•จ์ˆ˜
52
+ def check_all_urls():
53
+ for url in urls:
54
+ check_url(url)
55
+ schedule_next_run()
56
+
57
+ # ๋‹ค์Œ ์‹คํ–‰์„ ์˜ˆ์•ฝํ•˜๋Š” ํ•จ์ˆ˜ (15๋ถ„๋งˆ๋‹ค ์‹คํ–‰)
58
+ def schedule_next_run():
59
+ s.enter(900, 1, check_all_urls) # 900์ดˆ = 15๋ถ„
60
+ print(f"{datetime.now()}: ๋‹ค์Œ ์‹คํ–‰์ด ์˜ˆ์•ฝ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.")
61
+
62
+ # ์ดˆ๊ธฐ ์‹คํ–‰
63
+ print(f"{datetime.now()}: ํ”„๋กœ๊ทธ๋žจ ์‹œ์ž‘")
64
+ schedule_next_run()
65
+
66
+ # ์Šค์ผ€์ค„๋Ÿฌ ์‹คํ–‰
67
+ s.run()