Spaces:
Paused
Paused
set a public model to be used in the application
Browse files- app.py +5 -3
- listmodels.py +31 -0
app.py
CHANGED
|
@@ -3,7 +3,7 @@ from huggingface_hub import InferenceClient
|
|
| 3 |
import os
|
| 4 |
|
| 5 |
# Setze deinen Hugging Face API-Token hier
|
| 6 |
-
HF_TOKEN = os.getenv("HF_TOKEN")
|
| 7 |
|
| 8 |
#print("HF_TOKEN:", HF_TOKEN)
|
| 9 |
|
|
@@ -11,8 +11,10 @@ HF_TOKEN = os.getenv("HF_TOKEN")
|
|
| 11 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
| 12 |
"""
|
| 13 |
client = InferenceClient(
|
| 14 |
-
"Qwen/Qwen2.5-72B-Instruct",
|
| 15 |
-
|
|
|
|
|
|
|
| 16 |
)
|
| 17 |
|
| 18 |
|
|
|
|
| 3 |
import os
|
| 4 |
|
| 5 |
# Setze deinen Hugging Face API-Token hier
|
| 6 |
+
#HF_TOKEN = os.getenv("HF_TOKEN")
|
| 7 |
|
| 8 |
#print("HF_TOKEN:", HF_TOKEN)
|
| 9 |
|
|
|
|
| 11 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
| 12 |
"""
|
| 13 |
client = InferenceClient(
|
| 14 |
+
#"Qwen/Qwen2.5-72B-Instruct",
|
| 15 |
+
"XiaomiMiMo/MiMo-V2-Flash",
|
| 16 |
+
#"deepseek-ai/DeepSeek-R1",
|
| 17 |
+
#token=HF_TOKEN # Token from Environment Variable or passed directly
|
| 18 |
)
|
| 19 |
|
| 20 |
|
listmodels.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from huggingface_hub import HfApi
|
| 2 |
+
api = HfApi()
|
| 3 |
+
|
| 4 |
+
def find_public_chat_models(limit=50, scan_limit=2000, owners=None):
|
| 5 |
+
"""Return public chat-capable models optionally filtered by owner organizations.
|
| 6 |
+
|
| 7 |
+
- `owners` can be an iterable of owner names (e.g., ['google','qwen']).
|
| 8 |
+
"""
|
| 9 |
+
allowed_owners = set(o.lower() for o in owners) if owners else None
|
| 10 |
+
found = []
|
| 11 |
+
for m in api.list_models(pipeline_tag="text-generation", limit=scan_limit):
|
| 12 |
+
if getattr(m, "private", False):
|
| 13 |
+
continue
|
| 14 |
+
# Extract owner from modelId (format: owner/model_name)
|
| 15 |
+
model_id = m.modelId or ""
|
| 16 |
+
owner = model_id.split('/', 1)[0] if '/' in model_id else None
|
| 17 |
+
if allowed_owners and (owner is None or owner.lower() not in allowed_owners):
|
| 18 |
+
continue
|
| 19 |
+
tags = getattr(m, "tags", []) or []
|
| 20 |
+
if any(t in ("chat", "conversational", "instruct", "instruction-following") for t in tags):
|
| 21 |
+
found.append((m.modelId, owner, tags))
|
| 22 |
+
if len(found) >= limit:
|
| 23 |
+
break
|
| 24 |
+
return found
|
| 25 |
+
|
| 26 |
+
# Only show models owned by 'google' or 'qwen'
|
| 27 |
+
for model_id, owner, tags in find_public_chat_models(limit=10, owners=["google"]):
|
| 28 |
+
#print("---")
|
| 29 |
+
#print(model_id, "(owner:", owner + ")", tags)
|
| 30 |
+
print(model_id, "(owner:", owner + ")")
|
| 31 |
+
|