Spaces:
Sleeping
Sleeping
Aishwarya Solanki
commited on
Commit
·
7469ec2
1
Parent(s):
ae7ddef
Refining UI
Browse files
app.py
CHANGED
@@ -19,7 +19,7 @@ def validate_api_key(api_key, selected_model):
|
|
19 |
try:
|
20 |
response = requests.get(url, headers=headers)
|
21 |
if response.status_code == 200:
|
22 |
-
return {"is_valid": True, "message": '<p style="color: green;">API Key is valid!</p>'}
|
23 |
else:
|
24 |
return {"is_valid": False, "message": f'<p style="color: red;">Invalid OpenAI API Key. Status code: {response.status_code}</p>'}
|
25 |
except requests.exceptions.RequestException as e:
|
@@ -32,7 +32,7 @@ def validate_api_key(api_key, selected_model):
|
|
32 |
try:
|
33 |
response = requests.get(url, headers=headers)
|
34 |
if response.status_code == 200:
|
35 |
-
return {"is_valid": True, "message": '<p style="color: green;">API Key is valid!</p>'}
|
36 |
else:
|
37 |
return {"is_valid": False, "message": f'<p style="color: red;">Invalid Hugging Face API Key. Status code: {response.status_code}</p>'}
|
38 |
except requests.exceptions.RequestException as e:
|
@@ -42,7 +42,7 @@ def validate_api_key(api_key, selected_model):
|
|
42 |
genai.configure(api_key=api_key)
|
43 |
model = genai.GenerativeModel("gemini-1.5-flash")
|
44 |
response = model.generate_content("Help me diagnose the patient.")
|
45 |
-
return {"is_valid": True, "message": '<p style="color: green;">API Key is valid!</p>'}
|
46 |
except Exception as e:
|
47 |
return {"is_valid": False, "message": f'<p style="color: red;">Invalid Google API Key. Error: {e}</p>'}
|
48 |
|
|
|
19 |
try:
|
20 |
response = requests.get(url, headers=headers)
|
21 |
if response.status_code == 200:
|
22 |
+
return {"is_valid": True, "message": '<p style="color: green;">GPT API Key is valid!</p>'}
|
23 |
else:
|
24 |
return {"is_valid": False, "message": f'<p style="color: red;">Invalid OpenAI API Key. Status code: {response.status_code}</p>'}
|
25 |
except requests.exceptions.RequestException as e:
|
|
|
32 |
try:
|
33 |
response = requests.get(url, headers=headers)
|
34 |
if response.status_code == 200:
|
35 |
+
return {"is_valid": True, "message": '<p style="color: green;"> Llama API Key is valid!</p>'}
|
36 |
else:
|
37 |
return {"is_valid": False, "message": f'<p style="color: red;">Invalid Hugging Face API Key. Status code: {response.status_code}</p>'}
|
38 |
except requests.exceptions.RequestException as e:
|
|
|
42 |
genai.configure(api_key=api_key)
|
43 |
model = genai.GenerativeModel("gemini-1.5-flash")
|
44 |
response = model.generate_content("Help me diagnose the patient.")
|
45 |
+
return {"is_valid": True, "message": '<p style="color: green;">Gemini API Key is valid!</p>'}
|
46 |
except Exception as e:
|
47 |
return {"is_valid": False, "message": f'<p style="color: red;">Invalid Google API Key. Error: {e}</p>'}
|
48 |
|