Spaces:
Sleeping
Sleeping
Update app.py
Browse files4 unmodified lines56788910111112131415161717181920108 unmodified lines1291301311321321331341351364 unmodified linesfrom pypdf import PdfReaderfrom docx import Documentfrom sentence_transformers import SentenceTransformerfrom huggingface_hub import InferenceClientfrom groq import Groq
# ---------- الإعدادات ----------MODEL_ID = os.environ.get("MODEL_ID", "Qwen/Qwen2.5-72B-Instruct")MODEL_ID = os.environ.get("MODEL_ID", "llama-3.3-70b-versatile")EMBED_ID = "sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2"CHUNK_WORDS = 220OVERLAP_WORDS = 40
embedder = SentenceTransformer(EMBED_ID)client = InferenceClient(model=MODEL_ID, token=os.environ.get("HF_TOKEN"))client = Groq(api_key=os.environ.get("GROQ_API_KEY"))
SYSTEM_PROMPT = """You are a strict teaching assistant for ONE specific course.You will receive: (1) the course LEVEL description, (2) EXCERPTS from the course108 unmodified lines )
try: resp = client.chat_completion( resp = client.chat.completions.create( model=MODEL_ID, messages=[ {"role": "system", "content": SYSTEM_PROMPT}, {"role": "user", "content": user_msg},app.py+5-4