File size: 22,475 Bytes
3acbd6d |
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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
import gradio as gr
import requests
import logging
import datetime
import threading
import time
from pytz import timezone
from collections import defaultdict
logging.basicConfig(level=logging.INFO)
# ๋ก๊ทธ์ธ ์ธ์ฆ ์ ๋ณด
VALID_USERNAME = "ets2020"
VALID_PASSWORD = "1089"
# ๋ก๊ทธ์ธ ์ํ ๊ด๋ฆฌ
is_logged_in = False
# ๋ก๊ทธ์์ ์ฒ๋ฆฌ ํจ์
def process_logout():
global is_logged_in
is_logged_in = False
return gr.update(visible=True), gr.update(visible=False), gr.update(visible=False), None
# ์์ด๋๋ณ ์ด๋ฉ์ผ ๋ฐ ๋น๋ฐ๋ฒํธ ์ ๋ณด (์ค์ ๋ฐฐํฌ ์์๋ ๋ณด์์ ์ํด ๋ค๋ฅธ ๋ฐฉ์์ผ๋ก ๊ด๋ฆฌํ๋ ๊ฒ์ด ์ข์ต๋๋ค)
CREDENTIALS = {
"whispersound": ["*****", "*****"],
"happydoggg": ["*****", "*****"],
"magictreee": ["*****", "*****"],
"fastcarr": ["*****", "*****"],
"corpcorp1": ["*****", "*****"],
"rara527": ["*****", "*****"],
"bluskyyy": ["*****", "*****"],
"ssboost": ["*****", "*****"],
"ekdhstldhs": ["*****", "*****"],
}
# ์๋น์ค ๋ชฉ๋ก
TARGETS = [
{"name": "์๋๋ธ๋ก๊ทธ-์ผ๋ฐ+์ํ๊ฑด๊ฐ", "url": "https://huggingface.co/spaces/whispersound/kmkm_1-1"},
{"name": "์๋๋ธ๋ก๊ทธ-์ฌํ", "url": "https://huggingface.co/spaces/whispersound/kmkm_2-1"},
{"name": "์๋๋ธ๋ก๊ทธ-์ํ๋ฆฌ๋ทฐ", "url": "https://huggingface.co/spaces/whispersound/kmkm_3-1"},
{"name": "์๋๋ธ๋ก๊ทธ-ํต์ฌ๊ธฐ๋ฅ", "url": "https://huggingface.co/spaces/whispersound/kmkm_4-1"},
{"name": "์๋๋ธ๋ก๊ทธ-๋ฐฉ๋ฌธํ๊ธฐ", "url": "https://huggingface.co/spaces/whispersound/kmkm_5-1"},
{"name": "์๋๋ธ๋ก๊ทธ-์ผ๋ฐ", "url": "https://huggingface.co/spaces/whispersound/mmmha_1-1"},
{"name": "์๋๋ธ๋ก๊ทธ-์ฌํ", "url": "https://huggingface.co/spaces/whispersound/mmmha_2-1"},
{"name": "์๋๋ธ๋ก๊ทธ-์ํ๋ฆฌ๋ทฐ", "url": "https://huggingface.co/spaces/whispersound/mmmha_3-1"},
{"name": "์ ํ๋ธ-์์ฝ", "url": "https://huggingface.co/spaces/whispersound/ybyb-r-1"},
{"name": "์ ํ๋ธ-๋ธ๋ก๊ทธ(์ผ๋ฐ)", "url": "https://huggingface.co/spaces/whispersound/ybyb_1-1"},
{"name": "์ ํ๋ธ-๋ธ๋ก๊ทธ(์ํ๊ฑด๊ฐ)", "url": "https://huggingface.co/spaces/whispersound/ybyb_1-2-1"},
{"name": "์ ํ๋ธ-๋ธ๋ก๊ทธ(์ฌํ)", "url": "https://huggingface.co/spaces/whispersound/ybyb_2-1"},
{"name": "์ ํ๋ธ-๋ธ๋ก๊ทธ(์ํ๋ฆฌ๋ทฐ)", "url": "https://huggingface.co/spaces/whispersound/ybyb_3-1"},
{"name": "์ด์ปค๋จธ์ค-์นดํผ๋ผ์ดํ
", "url": "https://huggingface.co/spaces/whispersound/LuLu_cp_1_R-1"},
{"name": "์ด์ปค๋จธ-์์ธํ์ด์ง๊ธฐํ", "url": "https://huggingface.co/spaces/whispersound/plpl_1-1"},
{"name": "์๋๋ธ๋ก๊ทธ-์ผ๋ฐ+์ํ๊ฑด๊ฐ(์ ํด์ฉ)", "url": "https://huggingface.co/spaces/whispersound/kmkm_1-4"},
{"name": "์๋๋ธ๋ก๊ทธ-์ํ๋ฆฌ๋ทฐ(์ ํด์ฉ)", "url": "https://huggingface.co/spaces/whispersound/kmkm_3-4"},
{"name": "์๋๋ธ๋ก๊ทธ-ํต์ฌ๊ธฐ๋ฅ(์ ํด์ฉ)", "url": "https://huggingface.co/spaces/whispersound/kmkm_4-4"},
{"name": "์ปจํธ๋กค-์๋๋ธ๋ก๊ทธ", "url": "https://huggingface.co/spaces/fastcarr/ldleeer1-1"},
{"name": "์ปจํธ๋กค-์๋๋ธ๋ก๊ทธ", "url": "https://huggingface.co/spaces/fastcarr/lleryr1-1"},
{"name": "์ปจํธ๋กค-์ ํ๋ธ", "url": "https://huggingface.co/spaces/fastcarr/kketywe1-1"},
{"name": "์ปจํธ๋กค-์นดํผ์์ธ", "url": "https://huggingface.co/spaces/fastcarr/euywe1-1"},
{"name": "๊ธฐ๋ฅ-๋ฆฌ๋ทฐ๋ถ์", "url": "https://huggingface.co/spaces/fastcarr/vvvpppp_1-1"},
{"name": "๊ธฐ๋ฅ-๋ธ๋ก๊ทธํฌ๋กค๋ฌ", "url": "https://huggingface.co/spaces/fastcarr/ttpp323-1"},
{"name": "๊ธฐ๋ฅ-์ ํ๋ธ๋๋ณธ์ถ์ถ๊ธฐ", "url": "https://huggingface.co/spaces/fastcarr/YT_Ts_R-1"},
{"name": "๊ธฐ๋ฅ-PDF์์ฑ๊ธฐ", "url": "https://huggingface.co/spaces/fastcarr/gaewate1-1"},
{"name": "๊ธฐ๋ฅ-๋ธ๋ก๊ทธํฌ๋กค๋ฌ(์ ํด์ฉ)", "url": "https://huggingface.co/spaces/fastcarr/ttpp323-4"},
{"name": "๊ธฐ๋ฅ-์ ํ๋ธ๋๋ณธ์ถ์ถ๊ธฐ(์ ํด์ฉ)", "url": "https://huggingface.co/spaces/fastcarr/YT_Ts_R-4"},
{"name": "์๋๋ธ๋ก๊ทธ-์ผ๋ฐ+์ํ๊ฑด๊ฐ", "url": "https://huggingface.co/spaces/happydoggg/kmkm_1-2"},
{"name": "์๋๋ธ๋ก๊ทธ-์ฌํ", "url": "https://huggingface.co/spaces/happydoggg/kmkm_2-2"},
{"name": "์๋๋ธ๋ก๊ทธ-์ํ๋ฆฌ๋ทฐ", "url": "https://huggingface.co/spaces/happydoggg/kmkm_3-2"},
{"name": "์๋๋ธ๋ก๊ทธ-ํต์ฌ๊ธฐ๋ฅ", "url": "https://huggingface.co/spaces/happydoggg/kmkm_4-2"},
{"name": "์๋๋ธ๋ก๊ทธ-๋ฐฉ๋ฌธํ๊ธฐ", "url": "https://huggingface.co/spaces/happydoggg/kmkm_5-2"},
{"name": "์๋๋ธ๋ก๊ทธ-์ผ๋ฐ", "url": "https://huggingface.co/spaces/happydoggg/mmmha_1-2"},
{"name": "์๋๋ธ๋ก๊ทธ-์ฌํ", "url": "https://huggingface.co/spaces/happydoggg/mmmha_2-2"},
{"name": "์๋๋ธ๋ก๊ทธ-์ํ๋ฆฌ๋ทฐ", "url": "https://huggingface.co/spaces/happydoggg/mmmha_3-2"},
{"name": "์ ํ๋ธ-์์ฝ", "url": "https://huggingface.co/spaces/happydoggg/ybyb-r-2"},
{"name": "์ ํ๋ธ-๋ธ๋ก๊ทธ(์ผ๋ฐ)", "url": "https://huggingface.co/spaces/happydoggg/ybyb_1-2"},
{"name": "์ ํ๋ธ-๋ธ๋ก๊ทธ(์ํ๊ฑด๊ฐ)", "url": "https://huggingface.co/spaces/happydoggg/ybyb_1-2-2"},
{"name": "์ ํ๋ธ-๋ธ๋ก๊ทธ(์ฌํ)", "url": "https://huggingface.co/spaces/happydoggg/ybyb_2-2"},
{"name": "์ ํ๋ธ-๋ธ๋ก๊ทธ(์ํ๋ฆฌ๋ทฐ)", "url": "https://huggingface.co/spaces/happydoggg/ybyb_3-2"},
{"name": "์ด์ปค๋จธ์ค-์นดํผ๋ผ์ดํ
", "url": "https://huggingface.co/spaces/happydoggg/LuLu_cp_1_R-2"},
{"name": "์ด์ปค๋จธ์ค-์์ธํ์ด์ง๊ธฐํ", "url": "https://huggingface.co/spaces/happydoggg/plpl_1-2"},
{"name": "์ปจํธ๋กค-์๋๋ธ๋ก๊ทธ", "url": "https://huggingface.co/spaces/corpcorp1/ldleeer1-2"},
{"name": "์ปจํธ๋กค-์๋๋ธ๋ก๊ทธ", "url": "https://huggingface.co/spaces/corpcorp1/lleryr1-2"},
{"name": "์ปจํธ๋กค-์ ํ๋ธ", "url": "https://huggingface.co/spaces/corpcorp1/kketywe1-2"},
{"name": "์ปจํธ๋กค-์นดํผ์์ธ", "url": "https://huggingface.co/spaces/corpcorp1/euywe1-2"},
{"name": "๊ธฐ๋ฅ-๋ฆฌ๋ทฐ๋ถ์", "url": "https://huggingface.co/spaces/corpcorp1/vvvpppp_1-2"},
{"name": "๊ธฐ๋ฅ-๋ธ๋ก๊ทธํฌ๋กค๋ฌ", "url": "https://huggingface.co/spaces/corpcorp1/ttpp323-2"},
{"name": "๊ธฐ๋ฅ-์ ํ๋ธ๋๋ณธ์ถ์ถ๊ธฐ", "url": "https://huggingface.co/spaces/corpcorp1/YT_Ts_R-2"},
{"name": "๊ธฐ๋ฅ-PDF์์ฑ๊ธฐ", "url": "https://huggingface.co/spaces/corpcorp1/gaewate1-2"},
{"name": "์๋๋ธ๋ก๊ทธ-์ผ๋ฐ+์ํ๊ฑด๊ฐ", "url": "https://huggingface.co/spaces/magictreee/kmkm_1-3"},
{"name": "์๋๋ธ๋ก๊ทธ-์ฌํ", "url": "https://huggingface.co/spaces/magictreee/kmkm_2-3"},
{"name": "์๋๋ธ๋ก๊ทธ-์ํ๋ฆฌ๋ทฐ", "url": "https://huggingface.co/spaces/magictreee/kmkm_3-3"},
{"name": "์๋๋ธ๋ก๊ทธ-ํต์ฌ๊ธฐ๋ฅ", "url": "https://huggingface.co/spaces/magictreee/kmkm_4-3"},
{"name": "์๋๋ธ๋ก๊ทธ-๋ฐฉ๋ฌธํ๊ธฐ", "url": "https://huggingface.co/spaces/magictreee/kmkm_5-3"},
{"name": "์๋๋ธ๋ก๊ทธ-์ผ๋ฐ", "url": "https://huggingface.co/spaces/magictreee/mmmha_1-3"},
{"name": "์๋๋ธ๋ก๊ทธ-์ฌํ", "url": "https://huggingface.co/spaces/magictreee/mmmha_2-3"},
{"name": "์๋๋ธ๋ก๊ทธ-์ํ๋ฆฌ๋ทฐ", "url": "https://huggingface.co/spaces/magictreee/mmmha_3-3"},
{"name": "์ ํ๋ธ-์์ฝ", "url": "https://huggingface.co/spaces/magictreee/ybyb-r-3"},
{"name": "์ ํ๋ธ-๋ธ๋ก๊ทธ(์ผ๋ฐ)", "url": "https://huggingface.co/spaces/magictreee/ybyb_1-3"},
{"name": "์ ํ๋ธ-๋ธ๋ก๊ทธ(์ํ๊ฑด๊ฐ)", "url": "https://huggingface.co/spaces/magictreee/ybyb_1-2-3"},
{"name": "์ ํ๋ธ-๋ธ๋ก๊ทธ(์ฌํ)", "url": "https://huggingface.co/spaces/magictreee/ybyb_2-3"},
{"name": "์ ํ๋ธ-๋ธ๋ก๊ทธ(์ํ๋ฆฌ๋ทฐ)", "url": "https://huggingface.co/spaces/magictreee/ybyb_3-3"},
{"name": "์ด์ปค๋จธ์ค-์นดํผ๋ผ์ดํ
", "url": "https://huggingface.co/spaces/magictreee/LuLu_cp_1_R-3"},
{"name": "์ด์ปค๋จธ์ค-์์ธํ์ด์ง๊ธฐํ", "url": "https://huggingface.co/spaces/magictreee/plpl_1-3"},
{"name": "์ปจํธ๋กค-์๋๋ธ๋ก๊ทธ", "url": "https://huggingface.co/spaces/rara527/ldleeer1-3"},
{"name": "์ปจํธ๋กค-์๋๋ธ๋ก๊ทธ", "url": "https://huggingface.co/spaces/rara527/lleryr1-3"},
{"name": "์ปจํธ๋กค-์ ํ๋ธ", "url": "https://huggingface.co/spaces/rara527/kketywe1-3"},
{"name": "์ปจํธ๋กค-์นดํผ์์ธ", "url": "https://huggingface.co/spaces/rara527/euywe1-3"},
{"name": "๊ธฐ๋ฅ-๋ฆฌ๋ทฐ๋ถ์", "url": "https://huggingface.co/spaces/rara527/vvvpppp_1-3"},
{"name": "๊ธฐ๋ฅ-๋ธ๋ก๊ทธํฌ๋กค๋ฌ", "url": "https://huggingface.co/spaces/rara527/ttpp323-3"},
{"name": "๊ธฐ๋ฅ-์ ํ๋ธ๋๋ณธ์ถ์ถ๊ธฐ", "url": "https://huggingface.co/spaces/rara527/YT_Ts_R-3"},
{"name": "๊ธฐ๋ฅ-PDF์์ฑ๊ธฐ", "url": "https://huggingface.co/spaces/rara527/gaewate1-3"},
{"name": "๋ฉ์ธ๊ธฐ๋ฅ-์ํ๋ฐฐ๊ฒฝ์ด๋ฏธ์ง", "url": "https://huggingface.co/spaces/bluskyyy/asvdqw3g234"},
{"name": "๋ฉ์ธ๊ธฐ๋ฅ-๋ฆฌ๋ทฐ๋ถ์", "url": "https://huggingface.co/spaces/bluskyyy/4234g5hhs"},
{"name": "๋ฉ์ธ๊ธฐ๋ฅ-์ด๋ฏธ์ง์์ฑ๊ธฐ", "url": "https://huggingface.co/spaces/bluskyyy/asdfqwe"},
{"name": "๋ฉ์ธ๊ธฐ๋ฅ-๋ธ๋ก๊ทธํฌ์คํ
", "url": "https://huggingface.co/spaces/bluskyyy/33f23f3f-3"},
{"name": "์ด๋ฏธ์ง-๋ฐฐ๊ฒฝ์ ๊ฑฐ", "url": "https://huggingface.co/spaces/ssboost/B_G"},
{"name": "์ด๋ฏธ์ง-ํ์ง๊ฐ์ ๊ธฐ", "url": "https://huggingface.co/spaces/ssboost/Up_G"},
{"name": "์ด๋ฏธ์ง-ModelSwap", "url": "https://huggingface.co/spaces/ssboost/ModelSwap-1"},
{"name": "์ด๋ฏธ์ง-ํํฐ", "url": "https://huggingface.co/spaces/ssboost/Image_Filter-1"},
{"name": "์ด๋ฏธ์ง-๋ณต์", "url": "https://huggingface.co/spaces/ssboost/old_restoration-1"},
{"name": "์ด๋ฏธ์ง-์ด์ปค๋จธ์คAI์ด๋ฏธ์ง์์ฑ", "url": "https://huggingface.co/spaces/ssboost/6hjw3hs3"},
{"name": "์ด๋ฏธ์ง-๋ฐฐ๊ฒฝ์์ฑ๊ธฐ", "url": "https://huggingface.co/spaces/ssboost/g7yhw43gssdf"},
{"name": "์ด๋ฏธ์ง-๋ฐฐ๊ฒฝ์์ฑ๊ธฐ(์์)", "url": "https://huggingface.co/spaces/ssboost/asdfewef"},
{"name": "์ด๋ฏธ์ง-๋ฐฐ๊ฒฝ์์ฑ๊ธฐ(์ )", "url": "https://huggingface.co/spaces/ssboost/veegsd"},
{"name": "์ด๋ฏธ์ง-๋ธ๋ก๊ทธ์ด๋ฏธ์ง์", "url": "https://huggingface.co/spaces/ssboost/dfq23d"},
{"name": "์ด๋ฏธ์ง-์ด๋ฏธ์งํธ์ง", "url": "https://huggingface.co/spaces/ssboost/swq2f"},
{"name": "์ด์ปค๋จธ์ค-๋ฆฌ๋ทฐ๋ถ์", "url": "https://huggingface.co/spaces/ssboost/fe2fsd"},
{"name": "์ด์ปค๋จธ์ค-๋ค์ด๋ฒ์ผํ์ํ๋ช
๋ถ์", "url": "https://huggingface.co/spaces/ssboost/d34feer"},
{"name": "์ ์ฉํํด-๊ธ๋ค๋ฌ", "url": "https://huggingface.co/spaces/ssboost/E2T4TWEWEWE"},
{"name": "์ ์ฉํํด-์
๋ฌ ์๋ ๋ฒ์ญ๊ธฐ", "url": "https://huggingface.co/spaces/ssboost/G378DFE4AS"},
{"name": "์ ์ฉํํด-gif", "url": "https://huggingface.co/spaces/ssboost/gif-1"},
{"name": "์ ์ฉํํด-์ ์ฌ๋ฐฉ์ง์ด๋ฏธ์ง๋ณํ๊ธฐ", "url": "https://huggingface.co/spaces/ssboost/N_I"},
{"name": "์ ์ฉํํด-๋ธ๋ก๊ทธํํ์๋ถ์", "url": "https://huggingface.co/spaces/ssboost/ge3gsdgas"},
{"name": "๊ธ์ฐ๊ธฐ-์๋๋ธ๋ก๊ทธ", "url": "https://huggingface.co/spaces/ssboost/EWV2DDWEE"},
{"name": "๊ธ์ฐ๊ธฐ-์๋๋ธ๋ก๊ทธ", "url": "https://huggingface.co/spaces/ssboost/G3YGSDE"},
{"name": "๊ธ์ฐ๊ธฐ-์ ํ๋ธ", "url": "https://huggingface.co/spaces/ssboost/FVW3GSX3"},
{"name": "์ด์ปค๋จธ์ค-์ํ๋ช
(๋ฉ์ธํค์๋)", "url": "https://huggingface.co/spaces/ssboost/F23ASFGGD"},
{"name": "์ด์ปค๋จธ์ค-์ํ๋ช
(์ํ๋ช
๋ถ์)", "url": "https://huggingface.co/spaces/ssboost/F23ASFGGD-2"},
{"name": "์ด์ปค๋จธ์ค-์์ฑ๋ถ์๊ธฐ(ํ๋ฒ์ )", "url": "https://huggingface.co/spaces/ssboost/3gghdf5"},
{"name": "์ด์ปค๋จธ์ค-์์ฑ๋ถ์๊ธฐ(๊ฐ๋ตํ)", "url": "https://huggingface.co/spaces/ssboost/geo5g4gfj"},
{"name": "์ด๋ฏธ์ง-๊ธ์์ง์ฐ๊ธฐ", "url": "https://huggingface.co/spaces/ssboost/hkpdejhed"},
{"name": "์ด๋ฏธ์ง-์ด๋ฏธ์ง๋ฐ๊พธ๊ธฐ", "url": "https://huggingface.co/spaces/ssboost/g94h4jd"},
{"name": "๋ฉ์ธํ์ด์ง-๋ฆฌ๋ทฐ๋ถ์", "url": "https://huggingface.co/spaces/ekdhstldhs/86f86f80yg"},
{"name": "๋ฉ์ธํ์ด์ง-๋ธ๋ก๊ทธ์์ฑ", "url": "https://huggingface.co/spaces/ekdhstldhs/f23fewde"},
{"name": "๋ฉ์ธํ์ด์ง-์์ฑ๋ถ์๊ธฐ(ํ๋ฒ์ )", "url": "https://huggingface.co/spaces/ekdhstldhs/f232fwe"},
{"name": "๋ฉ์ธํ์ด์ง-์์ฑ๋ถ์๊ธฐ(๊ฐ๋ตํ)", "url": "https://huggingface.co/spaces/ekdhstldhs/df2wwewe"},
{"name": "๋ฉ์ธํ์ด์ง-์ธ๋ค์ผ๋ฐฐ๊ฒฝ๋ฐ๊พธ๊ธฐ", "url": "https://huggingface.co/spaces/ekdhstldhs/fsqwgvdsd"},
{"name": "๋ฉ์ธํ์ด์ง-์ด๋ฏธ์ง์์ฑ", "url": "https://huggingface.co/spaces/ekdhstldhs/g34ysdv234g"},
{"name": "๊ธฐํ๊ธฐ๋ฅ-๋ฐฐ๊ฒฝ์ง์ฐ๊ธฐ", "url": "https://huggingface.co/spaces/ekdhstldhs/df2wedds"},
{"name": "๊ธฐํ๊ธฐ๋ฅ-ํ์ง๊ฐ์ ๊ธฐ", "url": "https://huggingface.co/spaces/ekdhstldhs/fef232fsdes"},
{"name": "๋ณด์กฐ๊ธฐ๋ฅ-๋ธ๋ก๊ทธ(์ํ๋ฆฌ๋ทฐ)", "url": "https://huggingface.co/spaces/ekdhstldhs/kkie2"},
{"name": "๋ณด์กฐ๊ธฐ๋ฅ-๋ธ๋ก๊ทธ(ํต์ฌ๊ธฐ๋ฅ)", "url": "https://huggingface.co/spaces/ekdhstldhs/kkie3"}
]
KST = timezone('Asia/Seoul')
# ๋ก๊ทธ์ธ ์ฒ๋ฆฌ ํจ์
def process_login(username, password):
global is_logged_in
if username == VALID_USERNAME and password == VALID_PASSWORD:
is_logged_in = True
dashboard_html = update_dashboard() # ๋์๋ณด๋ ๋ฐ์ดํฐ ๋ก๋
return gr.update(visible=False), gr.update(visible=True), "๋ก๊ทธ์ธ ์ฑ๊ณต! ๋์๋ณด๋๋ก ์ด๋ํฉ๋๋ค.", dashboard_html
else:
return gr.update(visible=True), gr.update(visible=False), "์์ด๋ ๋๋ ๋น๋ฐ๋ฒํธ๊ฐ ์ผ์นํ์ง ์์ต๋๋ค.", None
# URL ์ํ ์ฒดํฌ ํจ์ - ๊ฐ์ ๋ ๋ฒ์
def check_url_status(url):
try:
response = requests.get(url, timeout=5)
response_text = response.text.lower()
# ํ์ด์ง๊ฐ ์ผ์์ค์ง๋ ๊ฒฝ์ฐ์ ๋ช
ํํ ํ์ ํ์ธ
if "paused by its owner" in response_text or "this space has been paused" in response_text:
return "Paused"
# ์๋ต ์ฝ๋ ํ์ธ
if response.status_code == 200:
# 200 OK์ด์ง๋ง ๋ด์ฉ์ ์ค๋ฅ ํค์๋๊ฐ ์๋์ง ํ์ธ
error_keywords = ["runtime error", "no application file", "build error",
"configuration error", "error", "failed"]
for keyword in error_keywords:
if keyword in response_text:
return "์ค๋ฅ"
# ๋ค๋ฅธ ์ํ ํค์๋๋ ํ์ธ
if "paused" in response_text:
return "Paused"
elif "sleeping" in response_text or "asleep" in response_text:
return "Sleeping"
elif "building" in response_text:
return "Building"
elif "restarting" in response_text:
return "Restarting"
elif "starting" in response_text:
return "Starting"
# ์ ์ ์คํ ์ค
return "Running"
elif response.status_code == 503:
return "Sleeping" # 503์ ์ผ๋ฐ์ ์ผ๋ก sleeping ์ํ
elif response.status_code >= 400:
return "์ค๋ฅ" # 400๋, 500๋ ์ฝ๋๋ ์ค๋ฅ
# ๊ธฐ๋ณธ๊ฐ
return "์ํ ๋ถ๋ช
"
except requests.exceptions.Timeout:
return "ํ์์์"
except requests.exceptions.ConnectionError:
return "์ฐ๊ฒฐ ์ค๋ฅ"
except Exception as e:
logging.error(f"URL ์ฒดํฌ ์ค ์ค๋ฅ ๋ฐ์: {url}, {str(e)}")
return "๊ธฐํ ์ค๋ฅ"
# HTML ๋ธ๋ก ์์ฑ ํจ์
def generate_html(targets):
grouped_by_id = defaultdict(lambda: defaultdict(list))
for target in targets:
user_id = target['url'].split('/')[4] # ์์ด๋ ์ถ์ถ
function = target['name'].split('-')[0] # ๊ธฐ๋ฅ๋ณ ์นดํ
๊ณ ๋ฆฌ ์ถ์ถ
grouped_by_id[user_id][function].append(target)
status_html = "<h2>์์ด๋๋ณ ๋ฐ ๊ธฐ๋ฅ๋ณ ๊ตฌ๋ถ</h2>"
# ์ํ๋ณ ํ
์คํธ ์์ ์ง์
status_colors = {
"Running": "#4CAF50", # ๋
น์
"Sleeping": "#808080", # ํ์
"Paused": "#FFA500", # ์ฃผํฉ์
"Building": "#2196F3", # ํ๋์
"Restarting": "#9C27B0", # ๋ณด๋ผ์
"Starting": "#03A9F4", # ํ๋์
"์ค๋ฅ": "#FF0000", # ๋นจ๊ฐ์
"ํ์์์": "#FF0000", # ๋นจ๊ฐ์
"์ฐ๊ฒฐ ์ค๋ฅ": "#FF0000", # ๋นจ๊ฐ์
"๊ธฐํ ์ค๋ฅ": "#FF0000", # ๋นจ๊ฐ์
"์ํ ๋ถ๋ช
": "#000000" # ๊ฒ์์
}
for user_id, functions in grouped_by_id.items():
email, password = CREDENTIALS.get(user_id, ["N/A", "N/A"]) # ์์ด๋๋ณ ์ด๋ฉ์ผ ๋ฐ ๋น๋ฐ๋ฒํธ
status_html += (
f"<div style='border: 2px solid #4CAF50; padding: 10px; margin: 10px 0; border-radius: 8px;'>"
f"<h3 style='font-size: 1.5em; font-weight: bold;'>์์ด๋๋ช
: {user_id}</h3>"
f"<p><strong>์ด๋ฉ์ผ:</strong> {email}<br><strong>๋น๋ฐ๋ฒํธ:</strong> {password}</p>"
)
for function, items in functions.items():
status_html += (
f"<div style='padding: 8px; margin: 5px 0; background-color: #F9F9F9; border-radius: 5px;'>"
f"<strong style='font-size: 1.2em;'>{function}</strong><br>"
)
for item in items:
item_name = item["name"].split('-')[-1] # ์ด๋ฆ์ ๋ง์ง๋ง ๋ถ๋ถ๋ง ํ์
status = check_url_status(item["url"])
# ์ํ์ ๋ฐ๋ฅธ ํ
์คํธ ์์ ์ง์
color = status_colors.get(status, "#000000")
item_html = (
f'<a href="{item["url"]}" target="_blank" style="color: {color}; '
f'text-decoration: none; margin: 2px; display: inline-block; '
f'padding: 5px; border: 1px solid #E0E0E0; border-radius: 3px;">'
f'{item_name} ({status})</a>'
)
status_html += item_html
status_html += "</div>"
status_html += "</div>"
return status_html
# ๋์๋ณด๋ ์
๋ฐ์ดํธ ํจ์
def update_dashboard():
# HTML ๋ธ๋ก ์์ฑ
html_content = generate_html(TARGETS)
# ํ์ฌ ์๊ฐ (์
๋ฐ์ดํธ ์๊ฐ)
current_time = datetime.datetime.now(KST).strftime('%Y.%m.%d %H:%M:%S')
# ์ต์ข
HTML ์์ฑ
full_html = f"{html_content}<p style='color: #7A7A7A;'>์
๋ฐ์ดํธ ์๊ฐ: {current_time}</p>"
return full_html
# ์๋ ์
๋ฐ์ดํธ๋ฅผ ์ํ ์บ์ ๋ณ์๋ค
dashboard_html_cache = ""
last_update_time = None
# ๋งค์ผ ์ค์ 7์์ ์คํ๋๋ ์ค์ผ์ค๋ฌ ํจ์
def schedule_daily_check():
global dashboard_html_cache, last_update_time
while True:
now = datetime.datetime.now(KST)
if now.hour == 7 and now.minute == 0:
logging.info("์ผ์ผ ์ํ ์ฒดํฌ ์คํ ์ค...")
# ์๋ ์
๋ฐ์ดํธ ๋ก์ง
dashboard_html_cache = generate_html(TARGETS)
last_update_time = now
logging.info(f"์ผ์ผ ์ํ ์ฒดํฌ ์๋ฃ: {now.strftime('%Y.%m.%d %H:%M:%S')}")
time.sleep(60) # ์ค๋ณต ์คํ ๋ฐฉ์ง
time.sleep(30) # 30์ด๋ง๋ค ์๊ฐ ํ์ธ
# ๋์๋ณด๋ ๊ฐ์ ธ์ค๊ธฐ ํจ์
def get_dashboard():
global dashboard_html_cache, last_update_time
# ์บ์๊ฐ ๋น์ด์๊ฑฐ๋ ๋ง์ง๋ง ์
๋ฐ์ดํธ ํ 1์๊ฐ์ด ์ง๋ฌ์ผ๋ฉด ์๋ก ์
๋ฐ์ดํธ
if dashboard_html_cache == "" or last_update_time is None or \
(datetime.datetime.now(KST) - last_update_time).seconds > 3600:
return update_dashboard()
# ์บ์๋ HTML์ ํ์ฌ ์๊ฐ ์ถ๊ฐ
current_time = datetime.datetime.now(KST).strftime('%Y.%m.%d %H:%M:%S')
return f"{dashboard_html_cache}<p style='color: #7A7A7A;'>์
๋ฐ์ดํธ ์๊ฐ: {current_time} (์บ์๋จ)</p>"
# ์ฑ ์์ฑ ํจ์
def create_app():
# CSS ์คํ์ผ ์ ์ - ํธํฐ ์จ๊น ๋ฐ ์ถ๊ฐ ์คํ์ผ
custom_css = """
footer {visibility: hidden}
.gradio-container {max-width: 1200px}
.login-container {max-width: 500px; margin: 0 auto; padding: 20px;}
"""
with gr.Blocks(css=custom_css) as app:
# ๋ก๊ทธ์ธ ํ์ด์ง
with gr.Group(visible=True, elem_classes="login-container") as login_page:
gr.Markdown("# ์๋น์ค ๋์๋ณด๋ ๋ก๊ทธ์ธ")
gr.Markdown("ํ๊น
ํ์ด์ค ์๋น์ค ๋์๋ณด๋์ ์ ์ํ๋ ค๋ฉด ๋ก๊ทธ์ธํ์ธ์.")
username_input = gr.Textbox(label="์์ด๋", placeholder="์์ด๋๋ฅผ ์
๋ ฅํ์ธ์")
password_input = gr.Textbox(label="๋น๋ฐ๋ฒํธ", placeholder="๋น๋ฐ๋ฒํธ๋ฅผ ์
๋ ฅํ์ธ์", type="password")
login_btn = gr.Button("๋ก๊ทธ์ธ", variant="primary", scale=1)
login_message = gr.Textbox(label="์ํ", interactive=False, visible=False)
# ๋ฉ์ธ ๋์๋ณด๋ ํ์ด์ง
with gr.Group(visible=False) as dashboard_page:
with gr.Row():
gr.Markdown("# ํ๊น
ํ์ด์ค ์๋น์ค ๋์๋ณด๋")
with gr.Row():
refresh_button = gr.Button("์ํ ์๋ก๊ณ ์นจ", variant="primary")
logout_button = gr.Button("๋ก๊ทธ์์", variant="secondary")
status_html = gr.HTML()
# ๋ก๊ทธ์ธ ์ด๋ฒคํธ ์ค์
login_btn.click(
fn=process_login,
inputs=[username_input, password_input],
outputs=[login_page, dashboard_page, login_message, status_html]
)
# ๋์๋ณด๋ ์๋ก๊ณ ์นจ ์ด๋ฒคํธ ์ค์
refresh_button.click(
fn=update_dashboard,
outputs=status_html
)
# ๋ก๊ทธ์์ ์ด๋ฒคํธ ์ค์
logout_button.click(
fn=process_logout,
outputs=[login_page, dashboard_page, login_message, status_html]
)
# ์ค์ผ์ค๋ฌ ์ค๋ ๋ ์คํ
threading.Thread(target=schedule_daily_check, daemon=True).start()
return app
# ๋ฉ์ธ ์คํ ์ฝ๋
if __name__ == "__main__":
app = create_app()
app.launch(share=False, server_name="0.0.0.0", server_port=7860) |