-
import gradio as gr
import requests
# Endpoints ثابتة
AZURE_CHAT_ENDPOINT = "https://lahja-dev-resource.cognitiveservices.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2025-01-01-preview"
AZURE_TTS_ENDPOINT = "https://lahja-dev-resource.cognitiveservices.azure.com/openai/deployments/LAHJA-V1/audio/speech?api-version=2025-03-01-preview"
# --- GPT رد ---
def chat_with_gpt(text, api_key):
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {api_key}"
}
# system prompt لتعريف الشخصية
messages = [
{
"role": "system",
"content": (
"انت مساعد ذكي اسمه (لهجة)، مطور من قبل شركة (أسس الذكاء الرقمي). "
"رد دايمًا باللهجة النجدية السعودية. "
"خلك مختصر وواضح."
)
},
{"role": "user", "content": text}
]
data = {
"messages": messages,
"max_tokens": 512,
"temperature": 0.8,
"top_p": 1,
"model":… -
import gradio as gr
import requests
# Endpoints ثابتة
AZURE_CHAT_ENDPOINT = "https://lahja-dev-resource.cognitiveservices.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2025-01-01-preview"
AZURE_TTS_ENDPOINT = "https://lahja-dev-resource.cognitiveservices.azure.com/openai/deployments/LAHJA-V1/audio/speech?api-version=2025-03-01-preview"
# --- GPT رد ---
def chat_with_gpt(text, api_key):
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {api_key}"
}
# system prompt لتعريف الشخصية
messages = [
{
"role": "system",
"content": (
"انت مساعد ذكي اسمه (لهجة)، مطور من قبل شركة (أسس الذكاء الرقمي). "
"رد دايمًا باللهجة النجدية السعودية. "
"خلك مختصر وواضح."
)
},
{"role": "user", "content": text}
]
data = {
"messages": messages,
"max_tokens": 512,
"temperature": 0.8,
"top_p": 1,
"model":… -
initial commit