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()