ELIA / utilities /utils.py
aaron0eidt's picture
Force dark mode theme for app
688668c
raw
history blame contribute delete
710 Bytes
import random
import numpy as np
import torch
import os
def set_seed(seed_value=42):
# Set a seed for reproducibility.
random.seed(seed_value)
np.random.seed(seed_value)
torch.manual_seed(seed_value)
if torch.cuda.is_available():
torch.cuda.manual_seed_all(seed_value)
def init_qwen_api():
# Set up the API configuration for Qwen.
api_key = os.environ.get("QWEN_API_KEY")
if not api_key:
# Fallback for local testing if env var is missing
api_key = "6e3def45d61b0b20547a1fcbab6464d8"
return {
"api_key": api_key,
"api_endpoint": "https://chat-ai.academiccloud.de/v1",
"model": "qwen2.5-vl-72b-instruct"
}