()
| 84 | |
| 85 | |
| 86 | def main(): |
| 87 | try: |
| 88 | title = os.environ.get("ISSUE_TITLE", "") |
| 89 | body = os.environ.get("ISSUE_BODY", "") |
| 90 | |
| 91 | client = InferenceClient(api_key=os.environ["HF_TOKEN"]) |
| 92 | |
| 93 | completion = client.chat.completions.create( |
| 94 | model=os.environ.get("HF_MODEL", "Qwen/Qwen3.5-35B-A3B"), |
| 95 | messages=[ |
| 96 | {"role": "system", "content": SYSTEM_PROMPT}, |
| 97 | {"role": "user", "content": USER_TEMPLATE.format(title=title, body=body)}, |
| 98 | ], |
| 99 | response_format={"type": "json_object"}, |
| 100 | temperature=0, |
| 101 | ) |
| 102 | |
| 103 | response = completion.choices[0].message.content.strip() |
| 104 | result = json.loads(response) |
| 105 | |
| 106 | labels = [l for l in result["labels"] if l in VALID_LABELS] |
| 107 | model_name = result.get("model_name") |
| 108 | |
| 109 | if model_name: |
| 110 | existing = get_existing_components() |
| 111 | if not any(model_name.lower() in name for name in existing): |
| 112 | labels.append("new-pipeline/model") |
| 113 | |
| 114 | if "bug" in labels and "Diffusers version:" not in body: |
| 115 | labels.append("needs-env-info") |
| 116 | |
| 117 | print(json.dumps(labels)) |
| 118 | except Exception: |
| 119 | print("Labeling failed", file=sys.stderr) |
| 120 | |
| 121 | |
| 122 | if __name__ == "__main__": |
no test coverage detected
searching dependent graphs…