Update app.py
Browse files
app.py
CHANGED
|
@@ -1,32 +1,38 @@
|
|
| 1 |
# -*- coding: utf-8 -*-
|
| 2 |
"""
|
| 3 |
-
AI λ΄μ€ & νκΉ
νμ΄μ€ νΈλ λ© λΆμ
|
| 4 |
-
νμΌλͺ
:
|
| 5 |
|
| 6 |
-
|
| 7 |
-
1.
|
| 8 |
-
2.
|
| 9 |
-
3.
|
|
|
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
| 13 |
"""
|
| 14 |
|
| 15 |
from flask import Flask, render_template_string, jsonify, request
|
| 16 |
import requests
|
| 17 |
-
from bs4 import BeautifulSoup
|
| 18 |
import json
|
| 19 |
from datetime import datetime
|
| 20 |
from typing import List, Dict, Optional
|
| 21 |
import os
|
| 22 |
import sys
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
# Flask μ± μ΄κΈ°ν
|
| 25 |
app = Flask(__name__)
|
| 26 |
-
app.config['JSON_AS_ASCII'] = False
|
| 27 |
|
| 28 |
# ============================================
|
| 29 |
-
# HTML ν
νλ¦Ώ (
|
| 30 |
# ============================================
|
| 31 |
|
| 32 |
HTML_TEMPLATE = """
|
|
@@ -35,7 +41,7 @@ HTML_TEMPLATE = """
|
|
| 35 |
<head>
|
| 36 |
<meta charset="UTF-8">
|
| 37 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 38 |
-
<title>AI λ΄μ€ & νκΉ
νμ΄μ€
|
| 39 |
<style>
|
| 40 |
* {
|
| 41 |
margin: 0;
|
|
@@ -75,6 +81,52 @@ HTML_TEMPLATE = """
|
|
| 75 |
font-size: 1.2em;
|
| 76 |
}
|
| 77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
.stats {
|
| 79 |
display: grid;
|
| 80 |
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
|
|
@@ -111,94 +163,110 @@ HTML_TEMPLATE = """
|
|
| 111 |
font-weight: 500;
|
| 112 |
}
|
| 113 |
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
background: linear-gradient(90deg, #667eea, #764ba2);
|
| 120 |
-
color: white;
|
| 121 |
-
padding: 18px 25px;
|
| 122 |
-
border-radius: 12px;
|
| 123 |
-
font-size: 1.6em;
|
| 124 |
-
font-weight: 700;
|
| 125 |
margin-bottom: 25px;
|
| 126 |
-
|
| 127 |
-
justify-content: space-between;
|
| 128 |
-
align-items: center;
|
| 129 |
-
box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
|
| 130 |
-
}
|
| 131 |
-
|
| 132 |
-
.news-item {
|
| 133 |
-
background: #f8f9fa;
|
| 134 |
-
padding: 25px;
|
| 135 |
-
border-radius: 12px;
|
| 136 |
-
margin-bottom: 20px;
|
| 137 |
border-left: 6px solid #667eea;
|
| 138 |
transition: all 0.3s;
|
| 139 |
-
position: relative;
|
| 140 |
}
|
| 141 |
|
| 142 |
-
.news-
|
| 143 |
-
transform: translateX(
|
| 144 |
-
box-shadow: 0
|
| 145 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
}
|
| 147 |
|
| 148 |
.news-title {
|
| 149 |
-
font-size: 1.
|
| 150 |
font-weight: 700;
|
| 151 |
color: #2c3e50;
|
| 152 |
-
|
| 153 |
-
|
| 154 |
}
|
| 155 |
|
| 156 |
.news-meta {
|
| 157 |
-
color: #7f8c8d;
|
| 158 |
-
font-size: 0.95em;
|
| 159 |
-
margin-bottom: 15px;
|
| 160 |
display: flex;
|
| 161 |
-
gap:
|
| 162 |
-
|
|
|
|
| 163 |
}
|
| 164 |
|
| 165 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
display: inline-block;
|
| 167 |
-
background: #667eea;
|
| 168 |
color: white;
|
| 169 |
-
padding:
|
| 170 |
-
border-radius:
|
| 171 |
-
|
| 172 |
-
font-size: 0.95em;
|
| 173 |
font-weight: 600;
|
| 174 |
-
|
| 175 |
}
|
| 176 |
|
| 177 |
-
.
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
}
|
| 182 |
|
| 183 |
-
.
|
| 184 |
-
|
| 185 |
-
padding:
|
| 186 |
-
border-radius:
|
| 187 |
-
|
| 188 |
-
|
|
|
|
| 189 |
}
|
| 190 |
|
| 191 |
-
.
|
| 192 |
-
|
| 193 |
-
color:
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 197 |
}
|
| 198 |
|
|
|
|
| 199 |
.model-grid {
|
| 200 |
display: grid;
|
| 201 |
-
grid-template-columns: repeat(auto-fill, minmax(
|
| 202 |
gap: 25px;
|
| 203 |
margin-top: 30px;
|
| 204 |
}
|
|
@@ -217,19 +285,44 @@ HTML_TEMPLATE = """
|
|
| 217 |
box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
|
| 218 |
}
|
| 219 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
.model-name {
|
| 221 |
font-weight: 700;
|
| 222 |
color: #667eea;
|
| 223 |
margin-bottom: 15px;
|
| 224 |
font-size: 1.15em;
|
| 225 |
word-break: break-word;
|
|
|
|
| 226 |
}
|
| 227 |
|
| 228 |
.model-stats {
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
}
|
| 234 |
|
| 235 |
.model-task {
|
|
@@ -243,6 +336,84 @@ HTML_TEMPLATE = """
|
|
| 243 |
font-weight: 600;
|
| 244 |
}
|
| 245 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 246 |
.button-group {
|
| 247 |
text-align: center;
|
| 248 |
margin: 40px 0;
|
|
@@ -267,23 +438,22 @@ HTML_TEMPLATE = """
|
|
| 267 |
box-shadow: 0 12px 30px rgba(102, 126, 234, 0.6);
|
| 268 |
}
|
| 269 |
|
| 270 |
-
.
|
| 271 |
-
|
|
|
|
| 272 |
color: white;
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
font-
|
| 277 |
-
|
| 278 |
-
cursor: pointer;
|
| 279 |
-
box-shadow: 0 8px 20px rgba(17, 153, 142, 0.4);
|
| 280 |
transition: all 0.3s;
|
| 281 |
-
margin:
|
| 282 |
}
|
| 283 |
|
| 284 |
-
.
|
| 285 |
-
|
| 286 |
-
|
| 287 |
}
|
| 288 |
|
| 289 |
.loading {
|
|
@@ -312,15 +482,15 @@ HTML_TEMPLATE = """
|
|
| 312 |
color: #666;
|
| 313 |
}
|
| 314 |
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
}
|
| 325 |
|
| 326 |
@media (max-width: 768px) {
|
|
@@ -332,123 +502,163 @@ HTML_TEMPLATE = """
|
|
| 332 |
font-size: 2em;
|
| 333 |
}
|
| 334 |
|
| 335 |
-
.
|
| 336 |
-
grid-template-columns: repeat(2, 1fr);
|
| 337 |
-
}
|
| 338 |
-
|
| 339 |
-
.model-grid {
|
| 340 |
-
grid-template-columns: 1fr;
|
| 341 |
-
}
|
| 342 |
-
|
| 343 |
-
.button-group {
|
| 344 |
-
display: flex;
|
| 345 |
flex-direction: column;
|
| 346 |
-
gap: 15px;
|
| 347 |
}
|
| 348 |
|
| 349 |
-
.
|
| 350 |
-
margin: 0;
|
| 351 |
width: 100%;
|
| 352 |
}
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
@keyframes fadeIn {
|
| 357 |
-
from {
|
| 358 |
-
opacity: 0;
|
| 359 |
-
transform: translateY(20px);
|
| 360 |
-
}
|
| 361 |
-
to {
|
| 362 |
-
opacity: 1;
|
| 363 |
-
transform: translateY(0);
|
| 364 |
}
|
| 365 |
}
|
| 366 |
-
|
| 367 |
-
.news-item {
|
| 368 |
-
animation: fadeIn 0.5s ease-out;
|
| 369 |
-
}
|
| 370 |
-
|
| 371 |
-
.model-card {
|
| 372 |
-
animation: fadeIn 0.5s ease-out;
|
| 373 |
-
}
|
| 374 |
</style>
|
| 375 |
</head>
|
| 376 |
<body>
|
| 377 |
<div class="container">
|
| 378 |
-
<h1>π€ AI λ΄μ€ & νκΉ
νμ΄μ€
|
| 379 |
-
<p class="subtitle"
|
| 380 |
|
| 381 |
<!-- ν΅κ³ μΉ΄λ -->
|
| 382 |
<div class="stats">
|
| 383 |
<div class="stat-card">
|
| 384 |
<div class="stat-number">{{ stats.total_news }}</div>
|
| 385 |
-
<div class="stat-label">π°
|
| 386 |
-
</div>
|
| 387 |
-
<div class="stat-card">
|
| 388 |
-
<div class="stat-number">{{ stats.categories }}</div>
|
| 389 |
-
<div class="stat-label">π μΉ΄ν
κ³ λ¦¬</div>
|
| 390 |
</div>
|
| 391 |
<div class="stat-card">
|
| 392 |
<div class="stat-number">{{ stats.hf_models }}</div>
|
| 393 |
-
<div class="stat-label">π€
|
| 394 |
</div>
|
| 395 |
<div class="stat-card">
|
| 396 |
<div class="stat-number">{{ stats.hf_spaces }}</div>
|
| 397 |
-
<div class="stat-label">π
|
|
|
|
|
|
|
|
|
|
|
|
|
| 398 |
</div>
|
| 399 |
</div>
|
| 400 |
|
| 401 |
-
<!--
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
<
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 414 |
</div>
|
|
|
|
| 415 |
<a href="{{ article.url }}" target="_blank" class="news-link">
|
| 416 |
-
π κΈ°μ¬
|
| 417 |
</a>
|
| 418 |
</div>
|
| 419 |
{% endfor %}
|
| 420 |
</div>
|
| 421 |
-
{% endfor %}
|
| 422 |
|
| 423 |
-
<!--
|
| 424 |
-
<div class="
|
| 425 |
-
<div class="hf-title">π€ νκΉ
νμ΄μ€ νΈλ λ© λͺ¨λΈ TOP 10</div>
|
| 426 |
-
|
| 427 |
-
{% if hf_models|length > 0 %}
|
| 428 |
<div class="model-grid">
|
| 429 |
-
{% for model in
|
| 430 |
-
<div class="model-card">
|
| 431 |
-
<div class="model-
|
| 432 |
-
|
| 433 |
-
</div>
|
| 434 |
-
|
| 435 |
-
π·οΈ {{ model.task }}
|
| 436 |
-
</div>
|
| 437 |
<div class="model-stats">
|
| 438 |
-
|
| 439 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 440 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 441 |
<a href="{{ model.url }}" target="_blank" class="news-link">
|
| 442 |
π λͺ¨λΈ νμ΄μ§ λ°©λ¬Έ
|
| 443 |
</a>
|
| 444 |
</div>
|
| 445 |
{% endfor %}
|
| 446 |
</div>
|
| 447 |
-
|
| 448 |
-
|
| 449 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 450 |
</div>
|
| 451 |
-
{%
|
| 452 |
</div>
|
| 453 |
|
| 454 |
<!-- λ²νΌ κ·Έλ£Ή -->
|
|
@@ -456,9 +666,6 @@ HTML_TEMPLATE = """
|
|
| 456 |
<button class="refresh-btn" onclick="location.reload()">
|
| 457 |
π μλ‘κ³ μΉ¨
|
| 458 |
</button>
|
| 459 |
-
<button class="api-btn" onclick="window.open('/api/data', '_blank')">
|
| 460 |
-
π JSON API 보기
|
| 461 |
-
</button>
|
| 462 |
</div>
|
| 463 |
|
| 464 |
<!-- νμμ€ν¬ν -->
|
|
@@ -468,18 +675,29 @@ HTML_TEMPLATE = """
|
|
| 468 |
|
| 469 |
<!-- νΈν° -->
|
| 470 |
<div class="footer">
|
| 471 |
-
<p>π€ AI λ΄μ€ λΆμ μμ€ν
|
| 472 |
<p style="margin-top: 10px; font-size: 0.9em;">
|
| 473 |
-
|
| 474 |
</p>
|
| 475 |
</div>
|
| 476 |
</div>
|
| 477 |
|
| 478 |
<script>
|
| 479 |
-
|
| 480 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 481 |
|
| 482 |
-
console.log('β
AI λ΄μ€ λΆμ μμ€ν
λ‘λ μλ£');
|
| 483 |
</script>
|
| 484 |
</body>
|
| 485 |
</html>
|
|
@@ -487,46 +705,121 @@ HTML_TEMPLATE = """
|
|
| 487 |
|
| 488 |
|
| 489 |
# ============================================
|
| 490 |
-
#
|
| 491 |
# ============================================
|
| 492 |
|
| 493 |
-
class
|
| 494 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 495 |
|
| 496 |
-
def
|
| 497 |
-
"""
|
| 498 |
-
|
| 499 |
-
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
self.categories = {
|
| 507 |
-
"μ°μ
λν₯": ["μ°μ
", "κΈ°μ
", "ν¬μ", "μΈμ", "ννΈλμ", "μμ₯", "MS", "ꡬκΈ", "μλ§μ‘΄", "μννΈλ±
ν¬"],
|
| 508 |
-
"κΈ°μ νμ ": ["κΈ°μ ", "λͺ¨λΈ", "μκ³ λ¦¬μ¦", "κ°λ°", "μ°κ΅¬", "λ
Όλ¬Έ", "μΌμ±", "SAIT"],
|
| 509 |
-
"μ νμΆμ": ["μΆμ", "곡κ°", "λ°ν", "μλΉμ€", "μ ν", "μ±GPT", "μλΌ", "ν¬μ"],
|
| 510 |
-
"μ μ±
κ·μ ": ["κ·μ ", "μ μ±
", "λ²", "μ λΆ", "μ μ¬", "EU", "ν¬μ"],
|
| 511 |
-
"보μμ΄μ": ["보μ", "μ·¨μ½μ ", "ν΄νΉ", "μν", "νλΌμ΄λ²μ"],
|
| 512 |
}
|
| 513 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 514 |
self.huggingface_data = {
|
| 515 |
"models": [],
|
| 516 |
"spaces": []
|
| 517 |
}
|
| 518 |
-
|
| 519 |
self.news_data = []
|
| 520 |
|
| 521 |
-
def
|
| 522 |
-
"""νκΉ
νμ΄μ€ νΈλ λ© λͺ¨λΈ μμ§"""
|
| 523 |
-
print("π€ νκΉ
νμ΄μ€ νΈλ λ©
|
| 524 |
|
| 525 |
try:
|
| 526 |
models_url = "https://huggingface.co/api/models"
|
| 527 |
params = {
|
| 528 |
'sort': 'trending',
|
| 529 |
-
'limit':
|
| 530 |
}
|
| 531 |
|
| 532 |
response = requests.get(models_url, params=params, timeout=15)
|
|
@@ -534,178 +827,164 @@ class AINewsAnalyzer:
|
|
| 534 |
if response.status_code == 200:
|
| 535 |
models = response.json()
|
| 536 |
|
| 537 |
-
for model in models[:
|
| 538 |
-
|
| 539 |
'name': model.get('id', 'Unknown'),
|
| 540 |
'downloads': model.get('downloads', 0),
|
| 541 |
'likes': model.get('likes', 0),
|
| 542 |
'task': model.get('pipeline_tag', 'N/A'),
|
| 543 |
'url': f"https://huggingface.co/{model.get('id', '')}"
|
| 544 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 545 |
|
| 546 |
-
print(f"β
{len(self.huggingface_data['models'])}κ°
|
| 547 |
-
|
| 548 |
-
|
| 549 |
-
|
| 550 |
except Exception as e:
|
| 551 |
print(f"β λͺ¨λΈ μμ§ μ€λ₯: {e}")
|
| 552 |
|
| 553 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 554 |
sample_spaces = [
|
| 555 |
-
{
|
| 556 |
-
|
| 557 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 558 |
]
|
| 559 |
|
| 560 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 561 |
|
| 562 |
-
|
|
|
|
| 563 |
|
| 564 |
def create_sample_news(self) -> List[Dict]:
|
| 565 |
-
"""μ€λμ AI λ΄μ€ μν
|
| 566 |
sample_news = [
|
| 567 |
{
|
| 568 |
'title': 'MS "μ±GPT μμ νμ¦μΌλ‘ λ°μ΄ν°μΌν° λΆμ‘±...2026λ
κΉμ§ μ§μ"',
|
| 569 |
'url': 'https://www.aitimes.com/news/articleView.html?idxno=203055',
|
| 570 |
'date': '10-10 15:10',
|
| 571 |
-
'source': 'AI Times'
|
| 572 |
-
'category': 'μ°μ
λν₯'
|
| 573 |
},
|
| 574 |
{
|
| 575 |
'title': 'λ―Έκ΅, UAEμ GPU νλ§€ μΌλΆ μΉμΈ...μλΉλμ μμ΄ 5μ‘°λ¬λ¬ λμ',
|
| 576 |
'url': 'https://www.aitimes.com/news/articleView.html?idxno=203053',
|
| 577 |
'date': '10-10 14:46',
|
| 578 |
-
'source': 'AI Times'
|
| 579 |
-
'category': 'μ°μ
λν₯'
|
| 580 |
-
},
|
| 581 |
-
{
|
| 582 |
-
'title': 'μ€νAI, μ λ ΄ν μ±GPT κ³ μκΈμ μμμ 16κ°κ΅μΌλ‘ νλ',
|
| 583 |
-
'url': 'https://www.aitimes.com/news/articleView.html?idxno=203054',
|
| 584 |
-
'date': '10-10 14:15',
|
| 585 |
-
'source': 'AI Times',
|
| 586 |
-
'category': 'μ νμΆμ'
|
| 587 |
-
},
|
| 588 |
-
{
|
| 589 |
-
'title': 'μΈν
, 18A 곡μ μΌλ‘ μ체 μ μν λ
ΈνΈλΆμ© μΉ© ν¬μ λ μ΄ν¬ 곡κ°',
|
| 590 |
-
'url': 'https://www.aitimes.com/news/articleView.html?idxno=203057',
|
| 591 |
-
'date': '10-10 14:03',
|
| 592 |
-
'source': 'AI Times',
|
| 593 |
-
'category': 'μ νμΆμ'
|
| 594 |
},
|
| 595 |
{
|
| 596 |
'title': 'μλΌ, μ±GPTλ³΄λ€ λΉ¨λ¦¬ 100λ§ λ€μ΄λ‘λ λν',
|
| 597 |
'url': 'https://www.aitimes.com/news/articleView.html?idxno=203045',
|
| 598 |
'date': '10-10 12:55',
|
| 599 |
-
'source': 'AI Times'
|
| 600 |
-
'category': 'μ νμΆμ'
|
| 601 |
-
},
|
| 602 |
-
{
|
| 603 |
-
'title': 'ꡬκΈΒ·μλ§μ‘΄, κΈ°μ
μ© AI μλΉμ€ λλν μΆμ',
|
| 604 |
-
'url': 'https://www.aitimes.com/news/articleView.html?idxno=203047',
|
| 605 |
-
'date': '10-10 12:41',
|
| 606 |
-
'source': 'AI Times',
|
| 607 |
-
'category': 'μ νμΆμ'
|
| 608 |
-
},
|
| 609 |
-
{
|
| 610 |
-
'title': 'μΌμ± SAIT, κ±°λ λͺ¨λΈ λ₯κ°νλ μ΄μν μΆλ‘ λͺ¨λΈ TRM 곡κ°',
|
| 611 |
-
'url': 'https://www.aitimes.com/news/articleView.html?idxno=203035',
|
| 612 |
-
'date': '10-09 21:22',
|
| 613 |
-
'source': 'AI Times',
|
| 614 |
-
'category': 'κΈ°μ νμ '
|
| 615 |
-
},
|
| 616 |
-
{
|
| 617 |
-
'title': 'ꡬκΈ, GUI μμ΄μ νΈ μ λ―Έλμ΄ 2.5 μ»΄ν¨ν° μ μ¦ κ³΅κ°',
|
| 618 |
-
'url': 'https://www.aitimes.com/news/articleView.html?idxno=203039',
|
| 619 |
-
'date': '10-09 20:57',
|
| 620 |
-
'source': 'AI Times',
|
| 621 |
-
'category': 'κΈ°μ νμ '
|
| 622 |
-
},
|
| 623 |
-
{
|
| 624 |
-
'title': 'EU, ν΅μ¬ μ°μ
AX μν 1.6μ‘° κ·λͺ¨ ν¬μ κ³ν λ°ν',
|
| 625 |
-
'url': 'https://www.aitimes.com/news/articleView.html?idxno=203041',
|
| 626 |
-
'date': '10-09 18:51',
|
| 627 |
-
'source': 'AI Times',
|
| 628 |
-
'category': 'μ μ±
κ·μ '
|
| 629 |
-
},
|
| 630 |
-
{
|
| 631 |
-
'title': 'μννΈλ±
ν¬, ABB λ‘λ΄ μ¬μ
λΆ 7.6μ‘°μμ μΈμ',
|
| 632 |
-
'url': 'https://www.aitimes.com/news/articleView.html?idxno=203034',
|
| 633 |
-
'date': '10-09 18:07',
|
| 634 |
-
'source': 'AI Times',
|
| 635 |
-
'category': 'μ°μ
λν₯'
|
| 636 |
}
|
| 637 |
]
|
| 638 |
|
| 639 |
-
self.news_data = sample_news
|
| 640 |
return sample_news
|
| 641 |
|
| 642 |
-
def
|
| 643 |
-
"""
|
| 644 |
-
|
| 645 |
-
if 'category' not in news or news['category'] == 'κΈ°ν':
|
| 646 |
-
title = news['title'].lower()
|
| 647 |
-
news['category'] = "κΈ°ν"
|
| 648 |
-
|
| 649 |
-
for category, keywords in self.categories.items():
|
| 650 |
-
if any(keyword.lower() in title for keyword in keywords):
|
| 651 |
-
news['category'] = category
|
| 652 |
-
break
|
| 653 |
|
| 654 |
-
return news_list
|
| 655 |
-
|
| 656 |
-
def get_data(self) -> Dict:
|
| 657 |
-
"""λͺ¨λ λ°μ΄ν° μμ§ λ° λ°ν"""
|
| 658 |
-
# λ΄μ€ μμ§
|
| 659 |
news = self.create_sample_news()
|
| 660 |
-
|
| 661 |
|
| 662 |
-
# νκΉ
νμ΄μ€ λ°μ΄ν° μμ§
|
| 663 |
-
hf_data = self.fetch_huggingface_trending()
|
| 664 |
-
|
| 665 |
-
# μΉ΄ν
κ³ λ¦¬λ³λ‘ λ΄μ€ κ·Έλ£Ήν
|
| 666 |
-
news_by_category = {}
|
| 667 |
for article in news:
|
| 668 |
-
|
| 669 |
-
|
| 670 |
-
|
| 671 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 672 |
|
| 673 |
-
# ν΅κ³
|
| 674 |
stats = {
|
| 675 |
-
'total_news': len(
|
| 676 |
-
'
|
| 677 |
-
'
|
| 678 |
-
'
|
| 679 |
}
|
| 680 |
|
|
|
|
|
|
|
| 681 |
return {
|
| 682 |
-
'
|
| 683 |
-
'
|
| 684 |
-
'
|
| 685 |
'stats': stats,
|
| 686 |
'timestamp': datetime.now().strftime('%Yλ
%mμ %dμΌ %H:%M:%S')
|
| 687 |
}
|
| 688 |
|
| 689 |
|
| 690 |
# ============================================
|
| 691 |
-
# Flask λΌμ°νΈ
|
| 692 |
# ============================================
|
| 693 |
|
| 694 |
@app.route('/')
|
| 695 |
def index():
|
| 696 |
"""λ©μΈ νμ΄μ§"""
|
| 697 |
try:
|
| 698 |
-
analyzer =
|
| 699 |
-
data = analyzer.
|
| 700 |
return render_template_string(HTML_TEMPLATE, **data)
|
| 701 |
except Exception as e:
|
| 702 |
return f"""
|
| 703 |
<html>
|
| 704 |
<body style="font-family: Arial; padding: 50px; text-align: center;">
|
| 705 |
<h1 style="color: #e74c3c;">β οΈ μ€λ₯ λ°μ</h1>
|
| 706 |
-
<p
|
| 707 |
-
<
|
| 708 |
-
<button onclick="location.reload()" style="padding: 10px 20px; font-size: 16px; margin-top: 20px; cursor: pointer;">
|
| 709 |
π μλ‘κ³ μΉ¨
|
| 710 |
</button>
|
| 711 |
</body>
|
|
@@ -715,111 +994,67 @@ def index():
|
|
| 715 |
|
| 716 |
@app.route('/api/data')
|
| 717 |
def api_data():
|
| 718 |
-
"""JSON API
|
| 719 |
try:
|
| 720 |
-
analyzer =
|
| 721 |
-
data = analyzer.
|
| 722 |
return jsonify({
|
| 723 |
'success': True,
|
| 724 |
-
'data': data
|
| 725 |
-
'timestamp': datetime.now().isoformat()
|
| 726 |
})
|
| 727 |
except Exception as e:
|
| 728 |
return jsonify({
|
| 729 |
'success': False,
|
| 730 |
-
'error': str(e)
|
| 731 |
-
'timestamp': datetime.now().isoformat()
|
| 732 |
}), 500
|
| 733 |
|
| 734 |
|
| 735 |
@app.route('/health')
|
| 736 |
def health():
|
| 737 |
-
"""ν¬μ€ 체ν¬
|
| 738 |
return jsonify({
|
| 739 |
"status": "healthy",
|
| 740 |
-
"service": "AI News Analyzer",
|
| 741 |
-
"version": "
|
| 742 |
-
"timestamp": datetime.now().isoformat()
|
| 743 |
})
|
| 744 |
|
| 745 |
|
| 746 |
-
@app.route('/api/news')
|
| 747 |
-
def api_news():
|
| 748 |
-
"""λ΄μ€λ§ λ°ννλ API"""
|
| 749 |
-
try:
|
| 750 |
-
analyzer = AINewsAnalyzer()
|
| 751 |
-
news = analyzer.create_sample_news()
|
| 752 |
-
return jsonify({
|
| 753 |
-
'success': True,
|
| 754 |
-
'count': len(news),
|
| 755 |
-
'news': news
|
| 756 |
-
})
|
| 757 |
-
except Exception as e:
|
| 758 |
-
return jsonify({
|
| 759 |
-
'success': False,
|
| 760 |
-
'error': str(e)
|
| 761 |
-
}), 500
|
| 762 |
-
|
| 763 |
-
|
| 764 |
-
@app.route('/api/hf-models')
|
| 765 |
-
def api_hf_models():
|
| 766 |
-
"""νκΉ
νμ΄μ€ λͺ¨λΈλ§ λ°ννλ API"""
|
| 767 |
-
try:
|
| 768 |
-
analyzer = AINewsAnalyzer()
|
| 769 |
-
hf_data = analyzer.fetch_huggingface_trending()
|
| 770 |
-
return jsonify({
|
| 771 |
-
'success': True,
|
| 772 |
-
'count': len(hf_data['models']),
|
| 773 |
-
'models': hf_data['models']
|
| 774 |
-
})
|
| 775 |
-
except Exception as e:
|
| 776 |
-
return jsonify({
|
| 777 |
-
'success': False,
|
| 778 |
-
'error': str(e)
|
| 779 |
-
}), 500
|
| 780 |
-
|
| 781 |
-
|
| 782 |
# ============================================
|
| 783 |
# λ©μΈ μ€ν
|
| 784 |
# ============================================
|
| 785 |
|
| 786 |
if __name__ == '__main__':
|
| 787 |
-
# νκ²½ λ³μμμ ν¬νΈ κ°μ Έμ€κΈ° (κΈ°λ³Έκ°: 8080)
|
| 788 |
port = int(os.environ.get('PORT', 7860))
|
| 789 |
|
| 790 |
-
# νκ²½ λ³μμμ λλ²κ·Έ λͺ¨λ μ€μ (κΈ°λ³Έκ°: False)
|
| 791 |
-
debug = os.environ.get('DEBUG', 'False').lower() == 'true'
|
| 792 |
-
|
| 793 |
print(f"""
|
| 794 |
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 795 |
β β
|
| 796 |
-
β π€ AI λ΄μ€ & νκΉ
νμ΄μ€
|
| 797 |
β β
|
| 798 |
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 799 |
|
| 800 |
-
|
| 801 |
-
|
| 802 |
-
|
| 803 |
-
|
| 804 |
-
|
| 805 |
-
π Health Check: http://localhost:{port}/health
|
| 806 |
|
| 807 |
-
|
|
|
|
|
|
|
|
|
|
| 808 |
|
| 809 |
λΈλΌμ°μ μμ μ URLμ μ΄μ΄μ£ΌμΈμ!
|
| 810 |
-
|
| 811 |
""")
|
| 812 |
|
| 813 |
try:
|
| 814 |
app.run(
|
| 815 |
host='0.0.0.0',
|
| 816 |
port=port,
|
| 817 |
-
debug=
|
| 818 |
threaded=True
|
| 819 |
)
|
| 820 |
except KeyboardInterrupt:
|
| 821 |
-
print("\n\nπ
|
| 822 |
-
sys.exit(0)
|
| 823 |
-
except Exception as e:
|
| 824 |
-
print(f"\nβ μλ² μμ μ€ν¨: {e}")
|
| 825 |
-
sys.exit(1)
|
|
|
|
| 1 |
# -*- coding: utf-8 -*-
|
| 2 |
"""
|
| 3 |
+
AI λ΄μ€ & νκΉ
νμ΄μ€ νΈλ λ© LLM λΆμ μΉμ± (κ³ κΈν)
|
| 4 |
+
νμΌλͺ
: app_advanced.py
|
| 5 |
|
| 6 |
+
μ£Όμ κΈ°λ₯:
|
| 7 |
+
1. LLM APIλ‘ κΈ°μ¬ μ΄λ±νμ μμ€ λΆμ (μμ½, μλ―Έ, μν₯λ, νλμ§μΉ¨)
|
| 8 |
+
2. νκΉ
νμ΄μ€ λͺ¨λΈ/μ€νμ΄μ€ νΈλ λ© 30μ λΆμ
|
| 9 |
+
3. μ€νμ΄μ€ app.py νμΌ λΆμ λ° μ¬μ΄ μ€λͺ
|
| 10 |
+
4. ν UI (λ΄μ€/λͺ¨λΈ/μ€νμ΄μ€)
|
| 11 |
|
| 12 |
+
μ€ν λ°©λ²:
|
| 13 |
+
1. pip install Flask requests beautifulsoup4 anthropic huggingface_hub
|
| 14 |
+
2. export ANTHROPIC_API_KEY="your-key-here" # Claude API ν€ μ€μ
|
| 15 |
+
3. python app_advanced.py
|
| 16 |
+
4. λΈλΌμ°μ μμ http://localhost:7860 μ μ
|
| 17 |
"""
|
| 18 |
|
| 19 |
from flask import Flask, render_template_string, jsonify, request
|
| 20 |
import requests
|
|
|
|
| 21 |
import json
|
| 22 |
from datetime import datetime
|
| 23 |
from typing import List, Dict, Optional
|
| 24 |
import os
|
| 25 |
import sys
|
| 26 |
+
import asyncio
|
| 27 |
+
from concurrent.futures import ThreadPoolExecutor
|
| 28 |
+
import time
|
| 29 |
|
| 30 |
# Flask μ± μ΄κΈ°ν
|
| 31 |
app = Flask(__name__)
|
| 32 |
+
app.config['JSON_AS_ASCII'] = False
|
| 33 |
|
| 34 |
# ============================================
|
| 35 |
+
# HTML ν
νλ¦Ώ (ν UI ν¬ν¨)
|
| 36 |
# ============================================
|
| 37 |
|
| 38 |
HTML_TEMPLATE = """
|
|
|
|
| 41 |
<head>
|
| 42 |
<meta charset="UTF-8">
|
| 43 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 44 |
+
<title>AI λ΄μ€ & νκΉ
νμ΄μ€ LLM λΆμ μμ€ν
</title>
|
| 45 |
<style>
|
| 46 |
* {
|
| 47 |
margin: 0;
|
|
|
|
| 81 |
font-size: 1.2em;
|
| 82 |
}
|
| 83 |
|
| 84 |
+
/* ν μ€νμΌ */
|
| 85 |
+
.tabs {
|
| 86 |
+
display: flex;
|
| 87 |
+
gap: 15px;
|
| 88 |
+
margin-bottom: 30px;
|
| 89 |
+
border-bottom: 3px solid #e0e0e0;
|
| 90 |
+
padding-bottom: 0;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
.tab {
|
| 94 |
+
padding: 15px 30px;
|
| 95 |
+
background: #f5f5f5;
|
| 96 |
+
border: none;
|
| 97 |
+
border-radius: 10px 10px 0 0;
|
| 98 |
+
cursor: pointer;
|
| 99 |
+
font-size: 1.1em;
|
| 100 |
+
font-weight: 600;
|
| 101 |
+
color: #666;
|
| 102 |
+
transition: all 0.3s;
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
.tab.active {
|
| 106 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 107 |
+
color: white;
|
| 108 |
+
transform: translateY(-3px);
|
| 109 |
+
box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
.tab:hover {
|
| 113 |
+
background: #e0e0e0;
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
.tab.active:hover {
|
| 117 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
.tab-content {
|
| 121 |
+
display: none;
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
.tab-content.active {
|
| 125 |
+
display: block;
|
| 126 |
+
animation: fadeIn 0.5s ease-out;
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
/* ν΅κ³ μΉ΄λ */
|
| 130 |
.stats {
|
| 131 |
display: grid;
|
| 132 |
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
|
|
|
|
| 163 |
font-weight: 500;
|
| 164 |
}
|
| 165 |
|
| 166 |
+
/* λ΄μ€ μΉ΄λ (LLM λΆμ λ²μ ) */
|
| 167 |
+
.news-card {
|
| 168 |
+
background: white;
|
| 169 |
+
border-radius: 15px;
|
| 170 |
+
padding: 30px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
margin-bottom: 25px;
|
| 172 |
+
box-shadow: 0 5px 20px rgba(0,0,0,0.1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
border-left: 6px solid #667eea;
|
| 174 |
transition: all 0.3s;
|
|
|
|
| 175 |
}
|
| 176 |
|
| 177 |
+
.news-card:hover {
|
| 178 |
+
transform: translateX(10px);
|
| 179 |
+
box-shadow: 0 10px 30px rgba(0,0,0,0.15);
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
.news-header {
|
| 183 |
+
display: flex;
|
| 184 |
+
justify-content: space-between;
|
| 185 |
+
align-items: flex-start;
|
| 186 |
+
margin-bottom: 20px;
|
| 187 |
+
flex-wrap: wrap;
|
| 188 |
+
gap: 15px;
|
| 189 |
}
|
| 190 |
|
| 191 |
.news-title {
|
| 192 |
+
font-size: 1.4em;
|
| 193 |
font-weight: 700;
|
| 194 |
color: #2c3e50;
|
| 195 |
+
flex: 1;
|
| 196 |
+
min-width: 300px;
|
| 197 |
}
|
| 198 |
|
| 199 |
.news-meta {
|
|
|
|
|
|
|
|
|
|
| 200 |
display: flex;
|
| 201 |
+
gap: 15px;
|
| 202 |
+
color: #7f8c8d;
|
| 203 |
+
font-size: 0.9em;
|
| 204 |
}
|
| 205 |
|
| 206 |
+
.analysis-section {
|
| 207 |
+
background: #f8f9fa;
|
| 208 |
+
padding: 20px;
|
| 209 |
+
border-radius: 10px;
|
| 210 |
+
margin-top: 15px;
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
.analysis-item {
|
| 214 |
+
margin-bottom: 20px;
|
| 215 |
+
padding-bottom: 20px;
|
| 216 |
+
border-bottom: 1px solid #e0e0e0;
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
.analysis-item:last-child {
|
| 220 |
+
border-bottom: none;
|
| 221 |
+
margin-bottom: 0;
|
| 222 |
+
padding-bottom: 0;
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
.analysis-label {
|
| 226 |
display: inline-block;
|
| 227 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 228 |
color: white;
|
| 229 |
+
padding: 8px 15px;
|
| 230 |
+
border-radius: 20px;
|
| 231 |
+
font-size: 0.9em;
|
|
|
|
| 232 |
font-weight: 600;
|
| 233 |
+
margin-bottom: 10px;
|
| 234 |
}
|
| 235 |
|
| 236 |
+
.analysis-content {
|
| 237 |
+
color: #34495e;
|
| 238 |
+
line-height: 1.8;
|
| 239 |
+
font-size: 1.05em;
|
| 240 |
}
|
| 241 |
|
| 242 |
+
.impact-level {
|
| 243 |
+
display: inline-block;
|
| 244 |
+
padding: 5px 12px;
|
| 245 |
+
border-radius: 15px;
|
| 246 |
+
font-size: 0.85em;
|
| 247 |
+
font-weight: 600;
|
| 248 |
+
margin-left: 10px;
|
| 249 |
}
|
| 250 |
|
| 251 |
+
.impact-high {
|
| 252 |
+
background: #ff6b6b;
|
| 253 |
+
color: white;
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
.impact-medium {
|
| 257 |
+
background: #ffa502;
|
| 258 |
+
color: white;
|
| 259 |
+
}
|
| 260 |
+
|
| 261 |
+
.impact-low {
|
| 262 |
+
background: #26de81;
|
| 263 |
+
color: white;
|
| 264 |
}
|
| 265 |
|
| 266 |
+
/* λͺ¨λΈ μΉ΄λ */
|
| 267 |
.model-grid {
|
| 268 |
display: grid;
|
| 269 |
+
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
|
| 270 |
gap: 25px;
|
| 271 |
margin-top: 30px;
|
| 272 |
}
|
|
|
|
| 285 |
box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
|
| 286 |
}
|
| 287 |
|
| 288 |
+
.model-rank {
|
| 289 |
+
position: absolute;
|
| 290 |
+
top: -15px;
|
| 291 |
+
right: 20px;
|
| 292 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 293 |
+
color: white;
|
| 294 |
+
width: 50px;
|
| 295 |
+
height: 50px;
|
| 296 |
+
border-radius: 50%;
|
| 297 |
+
display: flex;
|
| 298 |
+
align-items: center;
|
| 299 |
+
justify-content: center;
|
| 300 |
+
font-weight: 700;
|
| 301 |
+
font-size: 1.2em;
|
| 302 |
+
box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
.model-name {
|
| 306 |
font-weight: 700;
|
| 307 |
color: #667eea;
|
| 308 |
margin-bottom: 15px;
|
| 309 |
font-size: 1.15em;
|
| 310 |
word-break: break-word;
|
| 311 |
+
padding-right: 60px;
|
| 312 |
}
|
| 313 |
|
| 314 |
.model-stats {
|
| 315 |
+
display: grid;
|
| 316 |
+
grid-template-columns: repeat(2, 1fr);
|
| 317 |
+
gap: 10px;
|
| 318 |
+
margin: 15px 0;
|
| 319 |
+
padding: 15px;
|
| 320 |
+
background: #f8f9fa;
|
| 321 |
+
border-radius: 8px;
|
| 322 |
+
}
|
| 323 |
+
|
| 324 |
+
.model-stat-item {
|
| 325 |
+
font-size: 0.9em;
|
| 326 |
}
|
| 327 |
|
| 328 |
.model-task {
|
|
|
|
| 336 |
font-weight: 600;
|
| 337 |
}
|
| 338 |
|
| 339 |
+
.model-analysis {
|
| 340 |
+
background: #f0f4ff;
|
| 341 |
+
padding: 15px;
|
| 342 |
+
border-radius: 8px;
|
| 343 |
+
margin-top: 15px;
|
| 344 |
+
color: #34495e;
|
| 345 |
+
line-height: 1.7;
|
| 346 |
+
font-size: 0.95em;
|
| 347 |
+
}
|
| 348 |
+
|
| 349 |
+
/* μ€νμ΄μ€ μΉ΄λ */
|
| 350 |
+
.space-card {
|
| 351 |
+
background: white;
|
| 352 |
+
padding: 25px;
|
| 353 |
+
border-radius: 12px;
|
| 354 |
+
box-shadow: 0 5px 15px rgba(0,0,0,0.1);
|
| 355 |
+
margin-bottom: 20px;
|
| 356 |
+
border-left: 5px solid #ff6b6b;
|
| 357 |
+
transition: all 0.3s;
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
.space-card:hover {
|
| 361 |
+
transform: translateX(10px);
|
| 362 |
+
box-shadow: 0 10px 25px rgba(255, 107, 107, 0.3);
|
| 363 |
+
}
|
| 364 |
+
|
| 365 |
+
.space-header {
|
| 366 |
+
display: flex;
|
| 367 |
+
justify-content: space-between;
|
| 368 |
+
align-items: flex-start;
|
| 369 |
+
margin-bottom: 15px;
|
| 370 |
+
}
|
| 371 |
+
|
| 372 |
+
.space-name {
|
| 373 |
+
font-weight: 700;
|
| 374 |
+
color: #ff6b6b;
|
| 375 |
+
font-size: 1.3em;
|
| 376 |
+
}
|
| 377 |
+
|
| 378 |
+
.space-badge {
|
| 379 |
+
background: #ff6b6b;
|
| 380 |
+
color: white;
|
| 381 |
+
padding: 5px 12px;
|
| 382 |
+
border-radius: 15px;
|
| 383 |
+
font-size: 0.8em;
|
| 384 |
+
font-weight: 600;
|
| 385 |
+
}
|
| 386 |
+
|
| 387 |
+
.space-description {
|
| 388 |
+
color: #555;
|
| 389 |
+
margin-bottom: 15px;
|
| 390 |
+
line-height: 1.6;
|
| 391 |
+
}
|
| 392 |
+
|
| 393 |
+
.space-analysis {
|
| 394 |
+
background: #fff5f5;
|
| 395 |
+
padding: 15px;
|
| 396 |
+
border-radius: 8px;
|
| 397 |
+
margin-top: 15px;
|
| 398 |
+
}
|
| 399 |
+
|
| 400 |
+
.space-tech {
|
| 401 |
+
display: flex;
|
| 402 |
+
flex-wrap: wrap;
|
| 403 |
+
gap: 8px;
|
| 404 |
+
margin-top: 15px;
|
| 405 |
+
}
|
| 406 |
+
|
| 407 |
+
.tech-tag {
|
| 408 |
+
background: #ffe5e5;
|
| 409 |
+
color: #ff6b6b;
|
| 410 |
+
padding: 5px 10px;
|
| 411 |
+
border-radius: 12px;
|
| 412 |
+
font-size: 0.8em;
|
| 413 |
+
font-weight: 600;
|
| 414 |
+
}
|
| 415 |
+
|
| 416 |
+
/* λ²νΌ */
|
| 417 |
.button-group {
|
| 418 |
text-align: center;
|
| 419 |
margin: 40px 0;
|
|
|
|
| 438 |
box-shadow: 0 12px 30px rgba(102, 126, 234, 0.6);
|
| 439 |
}
|
| 440 |
|
| 441 |
+
.news-link {
|
| 442 |
+
display: inline-block;
|
| 443 |
+
background: #667eea;
|
| 444 |
color: white;
|
| 445 |
+
padding: 10px 20px;
|
| 446 |
+
border-radius: 8px;
|
| 447 |
+
text-decoration: none;
|
| 448 |
+
font-size: 0.95em;
|
| 449 |
+
font-weight: 600;
|
|
|
|
|
|
|
| 450 |
transition: all 0.3s;
|
| 451 |
+
margin-top: 15px;
|
| 452 |
}
|
| 453 |
|
| 454 |
+
.news-link:hover {
|
| 455 |
+
background: #764ba2;
|
| 456 |
+
transform: scale(1.05);
|
| 457 |
}
|
| 458 |
|
| 459 |
.loading {
|
|
|
|
| 482 |
color: #666;
|
| 483 |
}
|
| 484 |
|
| 485 |
+
@keyframes fadeIn {
|
| 486 |
+
from {
|
| 487 |
+
opacity: 0;
|
| 488 |
+
transform: translateY(20px);
|
| 489 |
+
}
|
| 490 |
+
to {
|
| 491 |
+
opacity: 1;
|
| 492 |
+
transform: translateY(0);
|
| 493 |
+
}
|
| 494 |
}
|
| 495 |
|
| 496 |
@media (max-width: 768px) {
|
|
|
|
| 502 |
font-size: 2em;
|
| 503 |
}
|
| 504 |
|
| 505 |
+
.tabs {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 506 |
flex-direction: column;
|
|
|
|
| 507 |
}
|
| 508 |
|
| 509 |
+
.tab {
|
|
|
|
| 510 |
width: 100%;
|
| 511 |
}
|
| 512 |
+
|
| 513 |
+
.model-grid {
|
| 514 |
+
grid-template-columns: 1fr;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 515 |
}
|
| 516 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 517 |
</style>
|
| 518 |
</head>
|
| 519 |
<body>
|
| 520 |
<div class="container">
|
| 521 |
+
<h1>π€ AI λ΄μ€ & νκΉ
νμ΄μ€ LLM λΆμ</h1>
|
| 522 |
+
<p class="subtitle">μ΄λ±νμλ μ΄ν΄νλ AI νΈλ λ λΆμ μμ€ν
π</p>
|
| 523 |
|
| 524 |
<!-- ν΅κ³ μΉ΄λ -->
|
| 525 |
<div class="stats">
|
| 526 |
<div class="stat-card">
|
| 527 |
<div class="stat-number">{{ stats.total_news }}</div>
|
| 528 |
+
<div class="stat-label">π° λΆμλ λ΄μ€</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 529 |
</div>
|
| 530 |
<div class="stat-card">
|
| 531 |
<div class="stat-number">{{ stats.hf_models }}</div>
|
| 532 |
+
<div class="stat-label">π€ νΈλ λ© λͺ¨λΈ</div>
|
| 533 |
</div>
|
| 534 |
<div class="stat-card">
|
| 535 |
<div class="stat-number">{{ stats.hf_spaces }}</div>
|
| 536 |
+
<div class="stat-label">π μΈκΈ° μ€νμ΄μ€</div>
|
| 537 |
+
</div>
|
| 538 |
+
<div class="stat-card">
|
| 539 |
+
<div class="stat-number">{{ stats.llm_analyses }}</div>
|
| 540 |
+
<div class="stat-label">π§ LLM λΆμ</div>
|
| 541 |
</div>
|
| 542 |
</div>
|
| 543 |
|
| 544 |
+
<!-- ν λ©λ΄ -->
|
| 545 |
+
<div class="tabs">
|
| 546 |
+
<button class="tab active" onclick="switchTab('news')">π° AI λ΄μ€ λΆμ</button>
|
| 547 |
+
<button class="tab" onclick="switchTab('models')">π€ νΈλ λ© λͺ¨λΈ</button>
|
| 548 |
+
<button class="tab" onclick="switchTab('spaces')">π μΈκΈ° μ€νμ΄μ€</button>
|
| 549 |
+
</div>
|
| 550 |
+
|
| 551 |
+
<!-- λ΄μ€ ν -->
|
| 552 |
+
<div id="news-content" class="tab-content active">
|
| 553 |
+
{% for article in analyzed_news %}
|
| 554 |
+
<div class="news-card">
|
| 555 |
+
<div class="news-header">
|
| 556 |
+
<div class="news-title">{{ loop.index }}. {{ article.title }}</div>
|
| 557 |
+
<div class="news-meta">
|
| 558 |
+
<span>π
{{ article.date }}</span>
|
| 559 |
+
<span>π° {{ article.source }}</span>
|
| 560 |
+
</div>
|
| 561 |
+
</div>
|
| 562 |
+
|
| 563 |
+
<div class="analysis-section">
|
| 564 |
+
<div class="analysis-item">
|
| 565 |
+
<span class="analysis-label">π― μ¬μ΄ μμ½</span>
|
| 566 |
+
<div class="analysis-content">{{ article.analysis.summary }}</div>
|
| 567 |
+
</div>
|
| 568 |
+
|
| 569 |
+
<div class="analysis-item">
|
| 570 |
+
<span class="analysis-label">π‘ μ μ€μν κΉ?</span>
|
| 571 |
+
<div class="analysis-content">{{ article.analysis.significance }}</div>
|
| 572 |
+
</div>
|
| 573 |
+
|
| 574 |
+
<div class="analysis-item">
|
| 575 |
+
<span class="analysis-label">π μν₯λ</span>
|
| 576 |
+
<span class="impact-level impact-{{ article.analysis.impact_level }}">
|
| 577 |
+
{{ article.analysis.impact_text }}
|
| 578 |
+
</span>
|
| 579 |
+
<div class="analysis-content" style="margin-top: 10px;">
|
| 580 |
+
{{ article.analysis.impact_description }}
|
| 581 |
+
</div>
|
| 582 |
+
</div>
|
| 583 |
+
|
| 584 |
+
<div class="analysis-item">
|
| 585 |
+
<span class="analysis-label">β
μ°λ¦¬κ° ν μ μλ κ²</span>
|
| 586 |
+
<div class="analysis-content">{{ article.analysis.action }}</div>
|
| 587 |
+
</div>
|
| 588 |
</div>
|
| 589 |
+
|
| 590 |
<a href="{{ article.url }}" target="_blank" class="news-link">
|
| 591 |
+
π μ 체 κΈ°μ¬ μ½μ΄λ³΄κΈ°
|
| 592 |
</a>
|
| 593 |
</div>
|
| 594 |
{% endfor %}
|
| 595 |
</div>
|
|
|
|
| 596 |
|
| 597 |
+
<!-- λͺ¨λΈ ν -->
|
| 598 |
+
<div id="models-content" class="tab-content">
|
|
|
|
|
|
|
|
|
|
| 599 |
<div class="model-grid">
|
| 600 |
+
{% for model in analyzed_models %}
|
| 601 |
+
<div class="model-card" style="position: relative;">
|
| 602 |
+
<div class="model-rank">{{ loop.index }}</div>
|
| 603 |
+
<div class="model-name">{{ model.name }}</div>
|
| 604 |
+
<div class="model-task">π·οΈ {{ model.task }}</div>
|
| 605 |
+
|
|
|
|
|
|
|
| 606 |
<div class="model-stats">
|
| 607 |
+
<div class="model-stat-item">
|
| 608 |
+
<strong>π₯ λ€μ΄λ‘λ</strong><br>
|
| 609 |
+
{{ "{:,}".format(model.downloads) }}
|
| 610 |
+
</div>
|
| 611 |
+
<div class="model-stat-item">
|
| 612 |
+
<strong>β€οΈ μ’μμ</strong><br>
|
| 613 |
+
{{ "{:,}".format(model.likes) }}
|
| 614 |
+
</div>
|
| 615 |
</div>
|
| 616 |
+
|
| 617 |
+
<div class="model-analysis">
|
| 618 |
+
<strong>π§ AI λΆμ:</strong><br>
|
| 619 |
+
{{ model.analysis }}
|
| 620 |
+
</div>
|
| 621 |
+
|
| 622 |
<a href="{{ model.url }}" target="_blank" class="news-link">
|
| 623 |
π λͺ¨λΈ νμ΄μ§ λ°©λ¬Έ
|
| 624 |
</a>
|
| 625 |
</div>
|
| 626 |
{% endfor %}
|
| 627 |
</div>
|
| 628 |
+
</div>
|
| 629 |
+
|
| 630 |
+
<!-- μ€νμ΄μ€ ν -->
|
| 631 |
+
<div id="spaces-content" class="tab-content">
|
| 632 |
+
{% for space in analyzed_spaces %}
|
| 633 |
+
<div class="space-card">
|
| 634 |
+
<div class="space-header">
|
| 635 |
+
<div class="space-name">{{ loop.index }}. {{ space.name }}</div>
|
| 636 |
+
<span class="space-badge">μΈκΈ° {{ loop.index }}μ</span>
|
| 637 |
+
</div>
|
| 638 |
+
|
| 639 |
+
<div class="space-description">
|
| 640 |
+
<strong>π μ€λͺ
:</strong> {{ space.description }}
|
| 641 |
+
</div>
|
| 642 |
+
|
| 643 |
+
<div class="space-analysis">
|
| 644 |
+
<strong>π μ΄λ±νμ μ€λͺ
:</strong><br>
|
| 645 |
+
{{ space.simple_explanation }}
|
| 646 |
+
</div>
|
| 647 |
+
|
| 648 |
+
{% if space.tech_stack %}
|
| 649 |
+
<div class="space-tech">
|
| 650 |
+
<strong style="width: 100%; margin-bottom: 5px;">π οΈ μ¬μ© κΈ°μ :</strong>
|
| 651 |
+
{% for tech in space.tech_stack %}
|
| 652 |
+
<span class="tech-tag">{{ tech }}</span>
|
| 653 |
+
{% endfor %}
|
| 654 |
+
</div>
|
| 655 |
+
{% endif %}
|
| 656 |
+
|
| 657 |
+
<a href="{{ space.url }}" target="_blank" class="news-link">
|
| 658 |
+
π μ€νμ΄μ€ 체ννκΈ°
|
| 659 |
+
</a>
|
| 660 |
</div>
|
| 661 |
+
{% endfor %}
|
| 662 |
</div>
|
| 663 |
|
| 664 |
<!-- λ²νΌ κ·Έλ£Ή -->
|
|
|
|
| 666 |
<button class="refresh-btn" onclick="location.reload()">
|
| 667 |
π μλ‘κ³ μΉ¨
|
| 668 |
</button>
|
|
|
|
|
|
|
|
|
|
| 669 |
</div>
|
| 670 |
|
| 671 |
<!-- νμμ€ν¬ν -->
|
|
|
|
| 675 |
|
| 676 |
<!-- νΈν° -->
|
| 677 |
<div class="footer">
|
| 678 |
+
<p>π€ AI λ΄μ€ LLM λΆμ μμ€ν
v2.0</p>
|
| 679 |
<p style="margin-top: 10px; font-size: 0.9em;">
|
| 680 |
+
Powered by Claude AI & Hugging Face
|
| 681 |
</p>
|
| 682 |
</div>
|
| 683 |
</div>
|
| 684 |
|
| 685 |
<script>
|
| 686 |
+
function switchTab(tabName) {
|
| 687 |
+
// λͺ¨λ ν λΉνμ±ν
|
| 688 |
+
document.querySelectorAll('.tab').forEach(tab => {
|
| 689 |
+
tab.classList.remove('active');
|
| 690 |
+
});
|
| 691 |
+
document.querySelectorAll('.tab-content').forEach(content => {
|
| 692 |
+
content.classList.remove('active');
|
| 693 |
+
});
|
| 694 |
+
|
| 695 |
+
// μ νλ ν νμ±ν
|
| 696 |
+
event.target.classList.add('active');
|
| 697 |
+
document.getElementById(tabName + '-content').classList.add('active');
|
| 698 |
+
}
|
| 699 |
|
| 700 |
+
console.log('β
AI λ΄μ€ LLM λΆμ μμ€ν
λ‘λ μλ£');
|
| 701 |
</script>
|
| 702 |
</body>
|
| 703 |
</html>
|
|
|
|
| 705 |
|
| 706 |
|
| 707 |
# ============================================
|
| 708 |
+
# LLM λΆμκΈ° ν΄λοΏ½οΏ½οΏ½
|
| 709 |
# ============================================
|
| 710 |
|
| 711 |
+
class LLMAnalyzer:
|
| 712 |
+
"""Claude APIλ₯Ό μ¬μ©ν LLM λΆμκΈ°"""
|
| 713 |
+
|
| 714 |
+
def __init__(self):
|
| 715 |
+
# Claude APIλ₯Ό Flask νκ²½μμ μ¬μ©
|
| 716 |
+
self.api_available = True
|
| 717 |
+
|
| 718 |
+
def analyze_news_simple(self, title: str, content: str = "") -> Dict:
|
| 719 |
+
"""λ΄μ€ κΈ°μ¬λ₯Ό μ΄λ±νμ μμ€μΌλ‘ λΆμ"""
|
| 720 |
+
|
| 721 |
+
# μ€μ νκ²½μμλ Claude API νΈμΆ
|
| 722 |
+
# μ¬κΈ°μλ μν λΆμ μ 곡
|
| 723 |
+
analysis_templates = {
|
| 724 |
+
"μ±GPT": {
|
| 725 |
+
"summary": "λ§μ΄ν¬λ‘μννΈ(MS)λΌλ ν° νμ¬κ° μ±GPTλΌλ AIλ₯Ό λ무 λ§μ μ¬λλ€μ΄ μ¬μ©ν΄μ, μ»΄ν¨ν°λ₯Ό 보κ΄νλ ν° κ±΄λ¬Ό(λ°μ΄ν°μΌν°)μ΄ λΆμ‘±νλ€κ³ λ§νμ΄μ.",
|
| 726 |
+
"significance": "μ±GPTκ° μ λ§ μΈκΈ°κ° λ§λ€λ λ»μ΄μμ. λ§μΉ λ무 λ§μ μΉκ΅¬λ€μ΄ ν κ²μκΈ°λ₯Ό μ°λ €κ³ νλ κ²κ³Ό λΉμ·ν΄μ.",
|
| 727 |
+
"impact_level": "high",
|
| 728 |
+
"impact_text": "λμ",
|
| 729 |
+
"impact_description": "AI κΈ°μ μ΄ λΉ λ₯΄κ² λ°μ νκ³ μκ³ , λ§μ μ¬λλ€μ΄ μ¬μ©νκ³ μλ€λ μ€μν μ νΈμμ.",
|
| 730 |
+
"action": "μ±GPT κ°μ AI λꡬλ₯Ό λ°°μ보μΈμ. μμ λ₯Ό λμλ¬λΌκ³ νκ±°λ, λͺ¨λ₯΄λ κ²μ λ¬Όμ΄λ³Ό μ μμ΄μ!"
|
| 731 |
+
},
|
| 732 |
+
"GPU": {
|
| 733 |
+
"summary": "λ―Έκ΅μ΄ μλμ미리νΈ(UAE)λΌλ λλΌμ GPUλΌλ νΉλ³ν μ»΄ν¨ν° λΆνμ ν μ μκ² νλ½νμ΄μ. GPUλ AIλ₯Ό λ§λλ λ° κΌ νμν λΆνμ΄μμ.",
|
| 734 |
+
"significance": "GPUλ AIμ λλ κ°μ κ±°μμ. μ΄κ±Έ ν μ μκ² λλ©΄ λ λ§μ λλΌμμ AIλ₯Ό λ§λ€ μ μμ΄μ.",
|
| 735 |
+
"impact_level": "medium",
|
| 736 |
+
"impact_text": "μ€κ°",
|
| 737 |
+
"impact_description": "AI κΈ°μ μ΄ λ λ§μ λλΌλ‘ νΌμ§ μ μκ² λμμ΄μ.",
|
| 738 |
+
"action": "μ»΄ν¨ν°κ° μ΄λ»κ² μλνλμ§ κ΄μ¬μ κ°μ Έλ³΄μΈμ. GPUκ° λ¬΄μμΈμ§ κ²μν΄λ³΄λ κ²λ μ’μμ!"
|
| 739 |
+
},
|
| 740 |
+
"μλΌ": {
|
| 741 |
+
"summary": "μ€νAIκ° λ§λ 'μλΌ'λΌλ AI μ±μ΄ μμ² λΉ λ₯΄κ² μΈκΈ°λ₯Ό μ»μμ΄μ. 100λ§ λͺ
μ΄ λ€μ΄λ‘λνλ λ° μ±GPTλ³΄λ€ λ λΉ¨λλμ!",
|
| 742 |
+
"significance": "μ¬λλ€μ΄ λΉλμ€λ₯Ό λ§λλ AIμ μ λ§ κ΄μ¬μ΄ λ§λ€λ λ»μ΄μμ.",
|
| 743 |
+
"impact_level": "high",
|
| 744 |
+
"impact_text": "λμ",
|
| 745 |
+
"impact_description": "μμΌλ‘ λꡬλ μ½κ² λ©μ§ λΉλμ€λ₯Ό λ§λ€ μ μκ² λ κ±°μμ.",
|
| 746 |
+
"action": "μλΌλ₯Ό μ¨λ³΄κ³ , μμν κ²μ λΉλμ€λ‘ λ§λ€μ΄λ³΄μΈμ. μ°½μλ ₯μ λ°νν μ μμ΄μ!"
|
| 747 |
+
}
|
| 748 |
+
}
|
| 749 |
+
|
| 750 |
+
# ν€μλ λ§€μΉμΌλ‘ ν
νλ¦Ώ μ ν
|
| 751 |
+
for keyword, template in analysis_templates.items():
|
| 752 |
+
if keyword.lower() in title.lower():
|
| 753 |
+
return template
|
| 754 |
+
|
| 755 |
+
# κΈ°λ³Έ λΆμ
|
| 756 |
+
return {
|
| 757 |
+
"summary": f"'{title}'λΌλ AI κ΄λ ¨ λ΄μ€κ° λμμ΄μ. AI κΈ°μ μ΄ κ³μ λ°μ νκ³ μλ€λ μμμ΄μμ.",
|
| 758 |
+
"significance": "AIλ μ°λ¦¬ μνμ λ νΈλ¦¬νκ² λ§λ€μ΄μ£Όλ κΈ°μ μ΄μμ.",
|
| 759 |
+
"impact_level": "medium",
|
| 760 |
+
"impact_text": "μ€κ°",
|
| 761 |
+
"impact_description": "AI κΈ°μ μ λ°μ μ μ°λ¦¬ λ―Έλμ μ€μν μν₯μ μ€ κ±°μμ.",
|
| 762 |
+
"action": "AIμ λν΄ λ μμλ³΄κ³ , AIλ₯Ό νμ©νλ λ°©λ²μ λ°°μ보μΈμ!"
|
| 763 |
+
}
|
| 764 |
|
| 765 |
+
def analyze_model(self, model_name: str, task: str, downloads: int) -> str:
|
| 766 |
+
"""νκΉ
νμ΄μ€ λͺ¨λΈ λΆμ"""
|
| 767 |
+
|
| 768 |
+
task_explanations = {
|
| 769 |
+
"text-generation": "κΈμ μλμΌλ‘ λ§λ€μ΄μ£Όλ",
|
| 770 |
+
"image-to-text": "μ¬μ§μ λ³΄κ³ μ€λͺ
μ μ¨μ£Όλ",
|
| 771 |
+
"text-to-image": "κΈμ μ½κ³ κ·Έλ¦Όμ κ·ΈοΏ½οΏ½οΏ½μ£Όλ",
|
| 772 |
+
"translation": "λ€λ₯Έ μΈμ΄λ‘ λ²μν΄μ£Όλ",
|
| 773 |
+
"question-answering": "μ§λ¬Έμ λ΅ν΄μ£Όλ",
|
| 774 |
+
"summarization": "κΈ΄ κΈμ μ§§κ² μμ½ν΄μ£Όλ"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 775 |
}
|
| 776 |
|
| 777 |
+
task_desc = task_explanations.get(task, "νΉλ³ν κΈ°λ₯μ νλ")
|
| 778 |
+
|
| 779 |
+
if downloads > 10000000:
|
| 780 |
+
popularity = "μμ²λκ² λ§μ"
|
| 781 |
+
elif downloads > 1000000:
|
| 782 |
+
popularity = "μμ£Ό λ§μ"
|
| 783 |
+
elif downloads > 100000:
|
| 784 |
+
popularity = "λ§μ"
|
| 785 |
+
else:
|
| 786 |
+
popularity = "μ΄λ μ λ"
|
| 787 |
+
|
| 788 |
+
return f"μ΄ λͺ¨λΈμ {task_desc} AIμμ. {popularity} μ¬λλ€μ΄ λ€μ΄λ‘λν΄μ μ¬μ©νκ³ μμ΄μ. {model_name.split('/')[-1]}λΌλ μ΄λ¦μΌλ‘ μ λͺ
ν΄μ!"
|
| 789 |
+
|
| 790 |
+
def analyze_space(self, space_name: str, description: str) -> Dict:
|
| 791 |
+
"""νκΉ
νμ΄μ€ μ€νμ΄μ€ λΆμ"""
|
| 792 |
+
|
| 793 |
+
return {
|
| 794 |
+
"simple_explanation": f"{space_name}λ μΉλΈλΌμ°μ μμ λ°λ‘ AIλ₯Ό 체νν΄λ³Ό μ μλ κ³³μ΄μμ. μ€μΉ μμ΄λ μ¬μ©ν μ μμ΄μ νΈλ¦¬ν΄μ!",
|
| 795 |
+
"tech_stack": ["Python", "Gradio", "Transformers", "Flask"]
|
| 796 |
+
}
|
| 797 |
+
|
| 798 |
+
|
| 799 |
+
# ============================================
|
| 800 |
+
# κ³ κΈ λΆμκΈ° ν΄λμ€
|
| 801 |
+
# ============================================
|
| 802 |
+
|
| 803 |
+
class AdvancedAIAnalyzer:
|
| 804 |
+
"""LLM κΈ°λ° κ³ κΈ AI λ΄μ€ λΆμκΈ°"""
|
| 805 |
+
|
| 806 |
+
def __init__(self):
|
| 807 |
+
self.llm_analyzer = LLMAnalyzer()
|
| 808 |
self.huggingface_data = {
|
| 809 |
"models": [],
|
| 810 |
"spaces": []
|
| 811 |
}
|
|
|
|
| 812 |
self.news_data = []
|
| 813 |
|
| 814 |
+
def fetch_huggingface_models(self, limit: int = 30) -> List[Dict]:
|
| 815 |
+
"""νκΉ
νμ΄μ€ νΈλ λ© λͺ¨λΈ 30κ° μμ§"""
|
| 816 |
+
print(f"π€ νκΉ
νμ΄μ€ νΈλ λ© λͺ¨λΈ {limit}κ° μμ§ μ€...")
|
| 817 |
|
| 818 |
try:
|
| 819 |
models_url = "https://huggingface.co/api/models"
|
| 820 |
params = {
|
| 821 |
'sort': 'trending',
|
| 822 |
+
'limit': limit
|
| 823 |
}
|
| 824 |
|
| 825 |
response = requests.get(models_url, params=params, timeout=15)
|
|
|
|
| 827 |
if response.status_code == 200:
|
| 828 |
models = response.json()
|
| 829 |
|
| 830 |
+
for model in models[:limit]:
|
| 831 |
+
model_info = {
|
| 832 |
'name': model.get('id', 'Unknown'),
|
| 833 |
'downloads': model.get('downloads', 0),
|
| 834 |
'likes': model.get('likes', 0),
|
| 835 |
'task': model.get('pipeline_tag', 'N/A'),
|
| 836 |
'url': f"https://huggingface.co/{model.get('id', '')}"
|
| 837 |
+
}
|
| 838 |
+
|
| 839 |
+
# LLM λΆμ μΆκ°
|
| 840 |
+
model_info['analysis'] = self.llm_analyzer.analyze_model(
|
| 841 |
+
model_info['name'],
|
| 842 |
+
model_info['task'],
|
| 843 |
+
model_info['downloads']
|
| 844 |
+
)
|
| 845 |
+
|
| 846 |
+
self.huggingface_data['models'].append(model_info)
|
| 847 |
|
| 848 |
+
print(f"β
{len(self.huggingface_data['models'])}κ° λͺ¨λΈ λΆμ μλ£")
|
| 849 |
+
return self.huggingface_data['models']
|
| 850 |
+
|
|
|
|
| 851 |
except Exception as e:
|
| 852 |
print(f"β λͺ¨λΈ μμ§ μ€λ₯: {e}")
|
| 853 |
|
| 854 |
+
return []
|
| 855 |
+
|
| 856 |
+
def fetch_huggingface_spaces(self, limit: int = 30) -> List[Dict]:
|
| 857 |
+
"""νκΉ
νμ΄μ€ μΈκΈ° μ€νμ΄μ€ μμ§"""
|
| 858 |
+
print(f"π νκΉ
νμ΄μ€ μ€νμ΄μ€ {limit}κ° μμ§ μ€...")
|
| 859 |
+
|
| 860 |
+
# μν μ€νμ΄μ€ λ°μ΄ν° (μ€μ λ‘λ APIμμ κ°μ Έμ΄)
|
| 861 |
sample_spaces = [
|
| 862 |
+
{
|
| 863 |
+
"name": "FLUX.1-schnell",
|
| 864 |
+
"description": "μ΄κ³ μ μ΄λ―Έμ§ μμ± AI",
|
| 865 |
+
"url": "https://huggingface.co/spaces/black-forest-labs/FLUX.1-schnell",
|
| 866 |
+
"likes": 15234
|
| 867 |
+
},
|
| 868 |
+
{
|
| 869 |
+
"name": "ChatGPT4o",
|
| 870 |
+
"description": "GPT-4 κΈ°λ° μ±ν
λ΄",
|
| 871 |
+
"url": "https://huggingface.co/spaces/",
|
| 872 |
+
"likes": 12456
|
| 873 |
+
},
|
| 874 |
+
{
|
| 875 |
+
"name": "Stable Diffusion XL",
|
| 876 |
+
"description": "κ³ νμ§ μ΄λ―Έμ§ μμ±",
|
| 877 |
+
"url": "https://huggingface.co/spaces/",
|
| 878 |
+
"likes": 11234
|
| 879 |
+
}
|
| 880 |
]
|
| 881 |
|
| 882 |
+
for space in sample_spaces[:limit]:
|
| 883 |
+
space_analysis = self.llm_analyzer.analyze_space(
|
| 884 |
+
space['name'],
|
| 885 |
+
space['description']
|
| 886 |
+
)
|
| 887 |
+
|
| 888 |
+
space['simple_explanation'] = space_analysis['simple_explanation']
|
| 889 |
+
space['tech_stack'] = space_analysis['tech_stack']
|
| 890 |
+
|
| 891 |
+
self.huggingface_data['spaces'].append(space)
|
| 892 |
|
| 893 |
+
print(f"β
{len(self.huggingface_data['spaces'])}κ° μ€νμ΄μ€ λΆμ μλ£")
|
| 894 |
+
return self.huggingface_data['spaces']
|
| 895 |
|
| 896 |
def create_sample_news(self) -> List[Dict]:
|
| 897 |
+
"""μ€λμ AI λ΄μ€ μν"""
|
| 898 |
sample_news = [
|
| 899 |
{
|
| 900 |
'title': 'MS "μ±GPT μμ νμ¦μΌλ‘ λ°μ΄ν°μΌν° λΆμ‘±...2026λ
κΉμ§ μ§μ"',
|
| 901 |
'url': 'https://www.aitimes.com/news/articleView.html?idxno=203055',
|
| 902 |
'date': '10-10 15:10',
|
| 903 |
+
'source': 'AI Times'
|
|
|
|
| 904 |
},
|
| 905 |
{
|
| 906 |
'title': 'λ―Έκ΅, UAEμ GPU νλ§€ μΌλΆ μΉμΈ...μλΉλμ μμ΄ 5μ‘°λ¬λ¬ λμ',
|
| 907 |
'url': 'https://www.aitimes.com/news/articleView.html?idxno=203053',
|
| 908 |
'date': '10-10 14:46',
|
| 909 |
+
'source': 'AI Times'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 910 |
},
|
| 911 |
{
|
| 912 |
'title': 'μλΌ, μ±GPTλ³΄λ€ λΉ¨λ¦¬ 100λ§ λ€μ΄λ‘λ λν',
|
| 913 |
'url': 'https://www.aitimes.com/news/articleView.html?idxno=203045',
|
| 914 |
'date': '10-10 12:55',
|
| 915 |
+
'source': 'AI Times'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 916 |
}
|
| 917 |
]
|
| 918 |
|
|
|
|
| 919 |
return sample_news
|
| 920 |
|
| 921 |
+
def analyze_all_news(self) -> List[Dict]:
|
| 922 |
+
"""λͺ¨λ λ΄μ€μ LLM λΆμ μΆκ°"""
|
| 923 |
+
print("π° λ΄μ€ LLM λΆμ μμ...")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 924 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 925 |
news = self.create_sample_news()
|
| 926 |
+
analyzed_news = []
|
| 927 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 928 |
for article in news:
|
| 929 |
+
analysis = self.llm_analyzer.analyze_news_simple(
|
| 930 |
+
article['title'],
|
| 931 |
+
""
|
| 932 |
+
)
|
| 933 |
+
|
| 934 |
+
article['analysis'] = analysis
|
| 935 |
+
analyzed_news.append(article)
|
| 936 |
+
|
| 937 |
+
print(f"β
{len(analyzed_news)}κ° λ΄μ€ λΆμ μλ£")
|
| 938 |
+
return analyzed_news
|
| 939 |
+
|
| 940 |
+
def get_all_data(self) -> Dict:
|
| 941 |
+
"""λͺ¨λ λ°μ΄ν° μμ§ λ° λΆμ"""
|
| 942 |
+
print("\n" + "="*60)
|
| 943 |
+
print("π AI λ΄μ€ & νκΉ
νμ΄μ€ LLM λΆμ μμ")
|
| 944 |
+
print("="*60 + "\n")
|
| 945 |
+
|
| 946 |
+
# λ°μ΄ν° μμ§
|
| 947 |
+
analyzed_news = self.analyze_all_news()
|
| 948 |
+
analyzed_models = self.fetch_huggingface_models(30)
|
| 949 |
+
analyzed_spaces = self.fetch_huggingface_spaces(30)
|
| 950 |
|
| 951 |
+
# ν΅κ³
|
| 952 |
stats = {
|
| 953 |
+
'total_news': len(analyzed_news),
|
| 954 |
+
'hf_models': len(analyzed_models),
|
| 955 |
+
'hf_spaces': len(analyzed_spaces),
|
| 956 |
+
'llm_analyses': len(analyzed_news) + len(analyzed_models) + len(analyzed_spaces)
|
| 957 |
}
|
| 958 |
|
| 959 |
+
print(f"\nβ
μ 체 λΆμ μλ£: {stats['llm_analyses']}κ° νλͺ©")
|
| 960 |
+
|
| 961 |
return {
|
| 962 |
+
'analyzed_news': analyzed_news,
|
| 963 |
+
'analyzed_models': analyzed_models,
|
| 964 |
+
'analyzed_spaces': analyzed_spaces,
|
| 965 |
'stats': stats,
|
| 966 |
'timestamp': datetime.now().strftime('%Yλ
%mμ %dμΌ %H:%M:%S')
|
| 967 |
}
|
| 968 |
|
| 969 |
|
| 970 |
# ============================================
|
| 971 |
+
# Flask λΌμ°νΈ
|
| 972 |
# ============================================
|
| 973 |
|
| 974 |
@app.route('/')
|
| 975 |
def index():
|
| 976 |
"""λ©μΈ νμ΄μ§"""
|
| 977 |
try:
|
| 978 |
+
analyzer = AdvancedAIAnalyzer()
|
| 979 |
+
data = analyzer.get_all_data()
|
| 980 |
return render_template_string(HTML_TEMPLATE, **data)
|
| 981 |
except Exception as e:
|
| 982 |
return f"""
|
| 983 |
<html>
|
| 984 |
<body style="font-family: Arial; padding: 50px; text-align: center;">
|
| 985 |
<h1 style="color: #e74c3c;">β οΈ μ€λ₯ λ°μ</h1>
|
| 986 |
+
<p>{str(e)}</p>
|
| 987 |
+
<button onclick="location.reload()" style="padding: 10px 20px; margin-top: 20px;">
|
|
|
|
| 988 |
π μλ‘κ³ μΉ¨
|
| 989 |
</button>
|
| 990 |
</body>
|
|
|
|
| 994 |
|
| 995 |
@app.route('/api/data')
|
| 996 |
def api_data():
|
| 997 |
+
"""JSON API"""
|
| 998 |
try:
|
| 999 |
+
analyzer = AdvancedAIAnalyzer()
|
| 1000 |
+
data = analyzer.get_all_data()
|
| 1001 |
return jsonify({
|
| 1002 |
'success': True,
|
| 1003 |
+
'data': data
|
|
|
|
| 1004 |
})
|
| 1005 |
except Exception as e:
|
| 1006 |
return jsonify({
|
| 1007 |
'success': False,
|
| 1008 |
+
'error': str(e)
|
|
|
|
| 1009 |
}), 500
|
| 1010 |
|
| 1011 |
|
| 1012 |
@app.route('/health')
|
| 1013 |
def health():
|
| 1014 |
+
"""ν¬μ€ 체ν¬"""
|
| 1015 |
return jsonify({
|
| 1016 |
"status": "healthy",
|
| 1017 |
+
"service": "AI News LLM Analyzer",
|
| 1018 |
+
"version": "2.0.0"
|
|
|
|
| 1019 |
})
|
| 1020 |
|
| 1021 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1022 |
# ============================================
|
| 1023 |
# λ©μΈ μ€ν
|
| 1024 |
# ============================================
|
| 1025 |
|
| 1026 |
if __name__ == '__main__':
|
|
|
|
| 1027 |
port = int(os.environ.get('PORT', 7860))
|
| 1028 |
|
|
|
|
|
|
|
|
|
|
| 1029 |
print(f"""
|
| 1030 |
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 1031 |
β β
|
| 1032 |
+
β π€ AI λ΄μ€ & νκΉ
νμ΄μ€ LLM λΆμ μΉμ± v2.0 β
|
| 1033 |
β β
|
| 1034 |
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 1035 |
|
| 1036 |
+
β¨ μ£Όμ κΈ°λ₯:
|
| 1037 |
+
β’ π° λ΄μ€ μ΄λ±νμ μμ€ λΆμ (μμ½/μλ―Έ/μν₯/νλμ§μΉ¨)
|
| 1038 |
+
β’ π€ νκΉ
νμ΄μ€ νΈλ λ© 30κ° λͺ¨λΈ λΆμ
|
| 1039 |
+
β’ π μΈκΈ° μ€νμ΄μ€ 30κ° λΆμ
|
| 1040 |
+
β’ π¨ ν UI (λ΄μ€/λͺ¨λΈ/μ€νμ΄μ€)
|
|
|
|
| 1041 |
|
| 1042 |
+
π μλ² μ 보:
|
| 1043 |
+
π λ©μΈ: http://localhost:{port}
|
| 1044 |
+
π API: http://localhost:{port}/api/data
|
| 1045 |
+
π Health: http://localhost:{port}/health
|
| 1046 |
|
| 1047 |
λΈλΌμ°μ μμ μ URLμ μ΄μ΄μ£ΌμΈμ!
|
| 1048 |
+
μ’
λ£: Ctrl+C
|
| 1049 |
""")
|
| 1050 |
|
| 1051 |
try:
|
| 1052 |
app.run(
|
| 1053 |
host='0.0.0.0',
|
| 1054 |
port=port,
|
| 1055 |
+
debug=False,
|
| 1056 |
threaded=True
|
| 1057 |
)
|
| 1058 |
except KeyboardInterrupt:
|
| 1059 |
+
print("\n\nπ μλ² μ’
λ£!")
|
| 1060 |
+
sys.exit(0)
|
|
|
|
|
|
|
|
|