apple muncy commited on
Commit
2ac848d
·
1 Parent(s): e93a32a

add Textbox

Browse files

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

Files changed (1) hide show
  1. app.py +15 -4
app.py CHANGED
@@ -30,6 +30,12 @@ HF_MODEL = os.getenv("HF_MODEL", "microsoft/DialoGPT-medium")
30
  DEFAULT_PROVIDER: Literal["hf-inference"] = "hf-inference"
31
  HF_PROVIDER = os.getenv("HF_PROVIDER", DEFAULT_PROVIDER)
32
 
 
 
 
 
 
 
33
  # Simple storage for processed tag operations
34
  tag_operations_store: List[Dict[str, Any]] = []
35
 
@@ -139,6 +145,9 @@ async def get_agent():
139
 
140
 
141
  def extract_tags_from_text(text: str) -> List[str]:
 
 
 
142
  """Extract potential tags from discussion text"""
143
  text_lower = text.lower()
144
 
@@ -398,8 +407,6 @@ Please process all {len(all_tags)} tags: {", ".join(all_tags)}
398
  print(error_msg)
399
  return error_msg
400
 
401
- payload_g=[]
402
-
403
  @my_app.post("/webhook")
404
  async def webhook_handler(request: Request, background_tasks: BackgroundTasks):
405
  """Handle HF Hub webhooks"""
@@ -410,7 +417,7 @@ async def webhook_handler(request: Request, background_tasks: BackgroundTasks):
410
 
411
  payload = await request.json()
412
  print(f"📥 Received webhook payload: {json.dumps(payload, indent=2)}")
413
- payload_g.append(payload)
414
  event = payload.get("event", {})
415
  scope = event.get("scope")
416
  action = event.get("action")
@@ -492,7 +499,7 @@ def create_gradio_app():
492
  - Supports common ML tags like: pytorch, tensorflow,
493
  text-generation, etc.
494
  """)
495
-
496
  with gr.Column():
497
  sim_repo = gr.Textbox(
498
  label="Repository",
@@ -543,6 +550,10 @@ def create_dashboard():
543
  - Supports common ML tags like: pytorch, tensorflow,
544
  text-generation, etc.
545
  """)
 
 
 
 
546
 
547
  with gr.Column():
548
  sim_repo = gr.Textbox(
 
30
  DEFAULT_PROVIDER: Literal["hf-inference"] = "hf-inference"
31
  HF_PROVIDER = os.getenv("HF_PROVIDER", DEFAULT_PROVIDER)
32
 
33
+ #global variables for gradio display
34
+ g_payload=[]
35
+
36
+ def fn_payload(g_payload):
37
+ return g_payload
38
+
39
  # Simple storage for processed tag operations
40
  tag_operations_store: List[Dict[str, Any]] = []
41
 
 
145
 
146
 
147
  def extract_tags_from_text(text: str) -> List[str]:
148
+
149
+ g_payload.append(text)
150
+
151
  """Extract potential tags from discussion text"""
152
  text_lower = text.lower()
153
 
 
407
  print(error_msg)
408
  return error_msg
409
 
 
 
410
  @my_app.post("/webhook")
411
  async def webhook_handler(request: Request, background_tasks: BackgroundTasks):
412
  """Handle HF Hub webhooks"""
 
417
 
418
  payload = await request.json()
419
  print(f"📥 Received webhook payload: {json.dumps(payload, indent=2)}")
420
+ g_payload.append(payload)
421
  event = payload.get("event", {})
422
  scope = event.get("scope")
423
  action = event.get("action")
 
499
  - Supports common ML tags like: pytorch, tensorflow,
500
  text-generation, etc.
501
  """)
502
+
503
  with gr.Column():
504
  sim_repo = gr.Textbox(
505
  label="Repository",
 
550
  - Supports common ML tags like: pytorch, tensorflow,
551
  text-generation, etc.
552
  """)
553
+ gr.Textbox(
554
+ label="Text to extract tag from"
555
+ value=g_payload
556
+ placeholder="payload"
557
 
558
  with gr.Column():
559
  sim_repo = gr.Textbox(