Gianpaolo Macario commited on
Commit
3e37c9a
Β·
unverified Β·
2 Parent(s): 7162d87 616af0c

Merge pull request #1 from gmacario/dev-gmacario

Browse files

feat: merge branch "dev-gmacario" to main

Files changed (5) hide show
  1. .gitignore +6 -0
  2. README.md +6 -4
  3. app.py +4 -1
  4. hf-mcp-course-unit31.code-workspace +11 -0
  5. mcp_server.py +3 -1
.gitignore ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ # hf-mcp-course-unit31/.gitignore
2
+
3
+ .env
4
+ __pycache__/
5
+
6
+ # EOF
README.md CHANGED
@@ -1,16 +1,16 @@
1
  ---
2
- title: tag-a-repo bot
3
  emoji: πŸ‘€
4
  colorFrom: purple
5
  colorTo: yellow
6
  sdk: gradio
7
- sdk_version: 5.31.0
8
  app_file: app.py
9
  pinned: false
10
  base_path: /gradio
11
  ---
12
 
13
- # HF Tagging Bot
14
 
15
  This is a bot that tags HuggingFace models when they are mentioned in discussions.
16
 
@@ -18,4 +18,6 @@ This is a bot that tags HuggingFace models when they are mentioned in discussion
18
 
19
  1. The bot listens to discussions on the HuggingFace Hub
20
  2. When a discussion is created, the bot checks for tag mentions in the comment
21
- 3. If a tag is mentioned, the bot adds the tag to the model repository via a PR
 
 
 
1
  ---
2
+ title: Hugging Face MCP Course - Unit 3.1
3
  emoji: πŸ‘€
4
  colorFrom: purple
5
  colorTo: yellow
6
  sdk: gradio
7
+ sdk_version: 5.34.2
8
  app_file: app.py
9
  pinned: false
10
  base_path: /gradio
11
  ---
12
 
13
+ <!-- # HF Tagging Bot -->
14
 
15
  This is a bot that tags HuggingFace models when they are mentioned in discussions.
16
 
 
18
 
19
  1. The bot listens to discussions on the HuggingFace Hub
20
  2. When a discussion is created, the bot checks for tag mentions in the comment
21
+ 3. If a tag is mentioned, the bot adds the tag to the model repository via a PR.
22
+
23
+ <!-- EOF -->
app.py CHANGED
@@ -462,7 +462,10 @@ async def simulate_webhook(
462
 
463
  def create_gradio_app():
464
  """Create Gradio interface"""
465
- with gr.Blocks(title="HF Tagging Bot", theme=gr.themes.Soft()) as demo:
 
 
 
466
  gr.Markdown("# 🏷️ HF Tagging Bot Dashboard")
467
  gr.Markdown("*Automatically adds tags to models when mentioned in discussions*")
468
 
 
462
 
463
  def create_gradio_app():
464
  """Create Gradio interface"""
465
+ with gr.Blocks(
466
+ title="HF Tagging Bot",
467
+ # theme=gr.themes.Soft()
468
+ ) as demo:
469
  gr.Markdown("# 🏷️ HF Tagging Bot Dashboard")
470
  gr.Markdown("*Automatically adds tags to models when mentioned in discussions*")
471
 
hf-mcp-course-unit31.code-workspace ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "folders": [
3
+ {
4
+ "path": "."
5
+ },
6
+ {
7
+ "path": "../hf-mcp-course"
8
+ }
9
+ ],
10
+ "settings": {}
11
+ }
mcp_server.py CHANGED
@@ -7,7 +7,7 @@ import os
7
  import json
8
  from fastmcp import FastMCP
9
  from huggingface_hub import HfApi, model_info, ModelCard, ModelCardData
10
- from huggingface_hub.utils import HfHubHTTPError
11
  from dotenv import load_dotenv
12
 
13
  load_dotenv()
@@ -123,6 +123,8 @@ This PR adds the `{new_tag}` tag to the model repository.
123
 
124
  **Current tags:** {", ".join(current_tags) if current_tags else "None"}
125
  **New tags:** {", ".join(updated_tags)}
 
 
126
  """
127
 
128
  print(f"πŸš€ Creating PR with title: {pr_title}")
 
7
  import json
8
  from fastmcp import FastMCP
9
  from huggingface_hub import HfApi, model_info, ModelCard, ModelCardData
10
+ from huggingface_hub.errors import HfHubHTTPError
11
  from dotenv import load_dotenv
12
 
13
  load_dotenv()
 
123
 
124
  **Current tags:** {", ".join(current_tags) if current_tags else "None"}
125
  **New tags:** {", ".join(updated_tags)}
126
+
127
+ πŸ€– This is a pull request created by the Hugging Face Hub Tagging Bot.
128
  """
129
 
130
  print(f"πŸš€ Creating PR with title: {pr_title}")