akhaliq HF Staff commited on
Commit
b250a34
·
1 Parent(s): e4bd6c5

add new qwen model

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py CHANGED
@@ -378,6 +378,11 @@ AVAILABLE_MODELS = [
378
  "name": "Qwen3-32B",
379
  "id": "Qwen/Qwen3-32B",
380
  "description": "Qwen3-32B model for code generation and general tasks"
 
 
 
 
 
381
  }
382
  ]
383
 
@@ -451,6 +456,17 @@ if not HF_TOKEN:
451
 
452
  def get_inference_client(model_id, provider="auto"):
453
  """Return an InferenceClient with provider based on model_id and user selection."""
 
 
 
 
 
 
 
 
 
 
 
454
  if model_id == "moonshotai/Kimi-K2-Instruct":
455
  provider = "groq"
456
  elif model_id == "Qwen/Qwen3-235B-A22B":
 
378
  "name": "Qwen3-32B",
379
  "id": "Qwen/Qwen3-32B",
380
  "description": "Qwen3-32B model for code generation and general tasks"
381
+ },
382
+ {
383
+ "name": "Qwen3-235B-A22B-Thinking",
384
+ "id": "qwen3-235b-a22b-thinking-2507",
385
+ "description": "Qwen3-235B-A22B-Thinking model with advanced reasoning capabilities via Dashscope"
386
  }
387
  ]
388
 
 
456
 
457
  def get_inference_client(model_id, provider="auto"):
458
  """Return an InferenceClient with provider based on model_id and user selection."""
459
+ # Special case for Dashscope Qwen thinking model
460
+ if model_id == "qwen3-235b-a22b-thinking-2507":
461
+ dashscope_api_key = os.getenv("DASHSCOPE_API_KEY")
462
+ if not dashscope_api_key:
463
+ raise RuntimeError("DASHSCOPE_API_KEY environment variable is not set. Please set it to your Dashscope API key.")
464
+ return OpenAI(
465
+ api_key=dashscope_api_key,
466
+ base_url="https://dashscope.aliyuncs.com/compatible-mode/v1"
467
+ )
468
+
469
+ # Handle other models with HuggingFace InferenceClient
470
  if model_id == "moonshotai/Kimi-K2-Instruct":
471
  provider = "groq"
472
  elif model_id == "Qwen/Qwen3-235B-A22B":