Spaces:
Runtime error
Runtime error
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." |