Spaces:
Runtime error
Runtime error
File size: 543 Bytes
e39541b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
import requests
import config
def get_gemini_response(user_input):
url = "https://api.google.com/gemini" # ضع الرابط الصحيح هنا
headers = {"Authorization": f"Bearer {config.GEMINI_API_KEY}"}
payload = {"prompt": user_input}
response = requests.post(url, headers=headers, json=payload)
if response.status_code == 200:
return response.json().get("response", "لم أفهم ذلك، حاول مرة أخرى!")
else:
return "حدث خطأ أثناء الاتصال بـ Gemini AI." |