Spaces:
Sleeping
Sleeping
apple muncy
commited on
Commit
·
abedc83
1
Parent(s):
3062ba4
add MCP Server label to loggerS
Browse filesSigned-off-by: apple muncy <[email protected]>
- mcp_server.py +4 -7
mcp_server.py
CHANGED
@@ -10,15 +10,12 @@ from huggingface_hub import HfApi, model_info, ModelCard, ModelCardData
|
|
10 |
from huggingface_hub.utils import HfHubHTTPError
|
11 |
from dotenv import load_dotenv
|
12 |
|
13 |
-
#adding logger
|
14 |
import logging
|
15 |
loggerS = logging.getLogger(__name__)
|
16 |
logging.basicConfig(filename='tag.log', encoding='utf-8', level=logging.DEBUG)
|
17 |
#for testing logger
|
18 |
-
loggerS.debug('This message should go to the log file')
|
19 |
-
loggerS.info('So should this')
|
20 |
-
loggerS.warning('And this, too')
|
21 |
-
loggerS.error('And non-ASCII stuff, too, like Øresund and Malmö')
|
22 |
|
23 |
load_dotenv()
|
24 |
|
@@ -36,7 +33,7 @@ mcp = FastMCP("hf-tagging-bot")
|
|
36 |
def get_current_tags(repo_id: str) -> str:
|
37 |
"""Get current tags from a HuggingFace model repository"""
|
38 |
print(f"🔧 get_current_tags called with repo_id: {repo_id}")
|
39 |
-
loggerS.info('🔧 get_current_tags called with repo_id %s', {repo_id})
|
40 |
if not hf_api:
|
41 |
error_result = {"error": "HF token not configured"}
|
42 |
json_str = json.dumps(error_result)
|
@@ -45,7 +42,7 @@ def get_current_tags(repo_id: str) -> str:
|
|
45 |
|
46 |
try:
|
47 |
print(f"📡 Fetching model info for: {repo_id}")
|
48 |
-
|
49 |
info = model_info(repo_id=repo_id, token=HF_TOKEN)
|
50 |
current_tags = info.tags if info.tags else []
|
51 |
print(f"🏷️ Found {len(current_tags)} tags: {current_tags}")
|
|
|
10 |
from huggingface_hub.utils import HfHubHTTPError
|
11 |
from dotenv import load_dotenv
|
12 |
|
13 |
+
#adding logger"🚀 Starting HF Tagging Bot...
|
14 |
import logging
|
15 |
loggerS = logging.getLogger(__name__)
|
16 |
logging.basicConfig(filename='tag.log', encoding='utf-8', level=logging.DEBUG)
|
17 |
#for testing logger
|
18 |
+
loggerS.debug('MCP-server, This message should go to the log file')
|
|
|
|
|
|
|
19 |
|
20 |
load_dotenv()
|
21 |
|
|
|
33 |
def get_current_tags(repo_id: str) -> str:
|
34 |
"""Get current tags from a HuggingFace model repository"""
|
35 |
print(f"🔧 get_current_tags called with repo_id: {repo_id}")
|
36 |
+
loggerS.info('🔧 MCP Server-get_current_tags called with repo_id %s', {repo_id})
|
37 |
if not hf_api:
|
38 |
error_result = {"error": "HF token not configured"}
|
39 |
json_str = json.dumps(error_result)
|
|
|
42 |
|
43 |
try:
|
44 |
print(f"📡 Fetching model info for: {repo_id}")
|
45 |
+
loggerS.info('📡 MCP Server-Fetching model info for: %', {repo_id})
|
46 |
info = model_info(repo_id=repo_id, token=HF_TOKEN)
|
47 |
current_tags = info.tags if info.tags else []
|
48 |
print(f"🏷️ Found {len(current_tags)} tags: {current_tags}")
|