Spaces:
Sleeping
Sleeping
Final Update
Browse files
main.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
from fastapi import FastAPI, UploadFile, File, Form, HTTPException
|
| 2 |
from fastapi.middleware.cors import CORSMiddleware
|
| 3 |
from pydantic import BaseModel
|
|
@@ -50,7 +51,7 @@ else:
|
|
| 50 |
print(f"🔑 GROQ_API_KEY detected (starts with: {GROQ_API_KEY[:8]}...)")
|
| 51 |
|
| 52 |
# --- DYNAMIC GROQ MODEL DISCOVERY ---
|
| 53 |
-
DEFAULT_MODEL = "
|
| 54 |
SELECTED_MODEL = DEFAULT_MODEL
|
| 55 |
|
| 56 |
if GROQ_API_KEY:
|
|
@@ -60,21 +61,19 @@ if GROQ_API_KEY:
|
|
| 60 |
available_ids = [m.id for m in models_data]
|
| 61 |
print(f"📋 Groq models accessible with this key: {available_ids}")
|
| 62 |
|
| 63 |
-
# Filter out
|
| 64 |
chat_models = [
|
| 65 |
m for m in available_ids
|
| 66 |
-
if
|
| 67 |
]
|
| 68 |
|
| 69 |
-
# Preferred models
|
| 70 |
preferences = [
|
| 71 |
-
"
|
| 72 |
-
"
|
| 73 |
-
"
|
| 74 |
-
"
|
| 75 |
-
"
|
| 76 |
-
"mixtral-8x7b-32768",
|
| 77 |
-
"gemma2-9b-it"
|
| 78 |
]
|
| 79 |
|
| 80 |
matched = next((m for m in preferences if m in chat_models), None)
|
|
@@ -239,4 +238,4 @@ Task:
|
|
| 239 |
"total_clauses_scanned": len(clauses),
|
| 240 |
"risks_found": len(results),
|
| 241 |
"results": results
|
| 242 |
-
}
|
|
|
|
| 1 |
+
|
| 2 |
from fastapi import FastAPI, UploadFile, File, Form, HTTPException
|
| 3 |
from fastapi.middleware.cors import CORSMiddleware
|
| 4 |
from pydantic import BaseModel
|
|
|
|
| 51 |
print(f"🔑 GROQ_API_KEY detected (starts with: {GROQ_API_KEY[:8]}...)")
|
| 52 |
|
| 53 |
# --- DYNAMIC GROQ MODEL DISCOVERY ---
|
| 54 |
+
DEFAULT_MODEL = "openai/gpt-oss-20b"
|
| 55 |
SELECTED_MODEL = DEFAULT_MODEL
|
| 56 |
|
| 57 |
if GROQ_API_KEY:
|
|
|
|
| 61 |
available_ids = [m.id for m in models_data]
|
| 62 |
print(f"📋 Groq models accessible with this key: {available_ids}")
|
| 63 |
|
| 64 |
+
# Filter out audio, guards/safeguards, and models requiring manual terms acceptance
|
| 65 |
chat_models = [
|
| 66 |
m for m in available_ids
|
| 67 |
+
if not any(k in m.lower() for k in ["whisper", "guard", "safeguard", "canopylabs", "orpheus"])
|
| 68 |
]
|
| 69 |
|
| 70 |
+
# Preferred models from your account's accessible list
|
| 71 |
preferences = [
|
| 72 |
+
"openai/gpt-oss-20b",
|
| 73 |
+
"qwen/qwen3.8-27b",
|
| 74 |
+
"openai/gpt-oss-120b",
|
| 75 |
+
"groq/compound-mini",
|
| 76 |
+
"allam-2-7b"
|
|
|
|
|
|
|
| 77 |
]
|
| 78 |
|
| 79 |
matched = next((m for m in preferences if m in chat_models), None)
|
|
|
|
| 238 |
"total_clauses_scanned": len(clauses),
|
| 239 |
"risks_found": len(results),
|
| 240 |
"results": results
|
| 241 |
+
}
|