apple muncy commited on
Commit
c4045aa
·
1 Parent(s): 170ba22

add 2nd button

Browse files

Signed-off-by: apple muncy <[email protected]>

Files changed (3) hide show
  1. __pycache__/app.cpython-311.pyc +0 -0
  2. app.py +20 -10
  3. mcp_server.py +3 -3
__pycache__/app.cpython-311.pyc CHANGED
Binary files a/__pycache__/app.cpython-311.pyc and b/__pycache__/app.cpython-311.pyc differ
 
app.py CHANGED
@@ -30,7 +30,7 @@ HF_PROVIDER = os.getenv("HF_PROVIDER", DEFAULT_PROVIDER)
30
 
31
  #global variables to make data avalable to gradio blocks
32
  g_tools = []
33
-
34
 
35
  # Simple storage for processed tag operations
36
  tag_operations_store: List[Dict[str, Any]] = []
@@ -533,20 +533,25 @@ def create_dash_app():
533
  """load tools"""
534
  global g_tools
535
  return g_tools
 
 
 
 
536
 
537
  with gr.Blocks(title="HF Tagging Bot", theme=gr.themes.Soft(font=[gr.themes.GoogleFont("Roboto"), "Open Sans", "sans-serif"])) as demo:
538
  gr.Markdown("# 🏷️ HF Tagging Bot Dashboard")
539
  gr.Markdown("*Tools found*")
540
- dash_btn = gr.Button("🏷️ Test Tag Detection")
541
-
542
-
543
  with gr.Column():
544
-
545
- dash_result = gr.Textbox(label="Result", lines=8)
546
-
 
547
  with gr.Column():
548
  dash_repo = gr.Textbox(
549
- label="Tools",
550
  value="none",
551
  placeholder="tool-name",
552
  )
@@ -554,8 +559,13 @@ def create_dash_app():
554
  dash_btn.click(
555
  fn=update_tools,
556
  inputs=[],
557
- outputs=dash_result,
558
- )
 
 
 
 
 
559
  return demo
560
 
561
 
 
30
 
31
  #global variables to make data avalable to gradio blocks
32
  g_tools = []
33
+ g_results =[]
34
 
35
  # Simple storage for processed tag operations
36
  tag_operations_store: List[Dict[str, Any]] = []
 
533
  """load tools"""
534
  global g_tools
535
  return g_tools
536
+
537
+ def update_results():
538
+ global g_results
539
+ return g_results
540
 
541
  with gr.Blocks(title="HF Tagging Bot", theme=gr.themes.Soft(font=[gr.themes.GoogleFont("Roboto"), "Open Sans", "sans-serif"])) as demo:
542
  gr.Markdown("# 🏷️ HF Tagging Bot Dashboard")
543
  gr.Markdown("*Tools found*")
544
+ dash_btn = gr.Button("🏷️ Test Tool Detection")
545
+
546
+
547
  with gr.Column():
548
+ tool_result = gr.Textbox(label="Tools found", lines=8)
549
+
550
+
551
+ result_btn = gr.Button("Refresh Results")
552
  with gr.Column():
553
  dash_repo = gr.Textbox(
554
+ label="Results",
555
  value="none",
556
  placeholder="tool-name",
557
  )
 
559
  dash_btn.click(
560
  fn=update_tools,
561
  inputs=[],
562
+ outputs=tool_result,
563
+ )
564
+ result_btn.click(
565
+ fn=update_results,
566
+ inputs=[],
567
+ outputs=dash_repo,
568
+ )
569
  return demo
570
 
571
 
mcp_server.py CHANGED
@@ -38,14 +38,14 @@ def get_current_tags(repo_id: str) -> str:
38
  info = model_info(repo_id=repo_id, token=HF_TOKEN)
39
  current_tags = info.tags if info.tags else []
40
  print(f"🏷️ Found {len(current_tags)} tags: {current_tags}")
41
-
42
- result = {
43
  "status": "success",
44
  "repo_id": repo_id,
45
  "current_tags": current_tags,
46
  "count": len(current_tags),
47
  }
48
- json_str = json.dumps(result)
49
  print(f"✅ get_current_tags returning: {json_str}")
50
  return json_str
51
 
 
38
  info = model_info(repo_id=repo_id, token=HF_TOKEN)
39
  current_tags = info.tags if info.tags else []
40
  print(f"🏷️ Found {len(current_tags)} tags: {current_tags}")
41
+ global g_results
42
+ g_results = {
43
  "status": "success",
44
  "repo_id": repo_id,
45
  "current_tags": current_tags,
46
  "count": len(current_tags),
47
  }
48
+ json_str = json.dumps(g_results)
49
  print(f"✅ get_current_tags returning: {json_str}")
50
  return json_str
51