Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import anthropic
|
|
|
|
| 3 |
from api_usage import get_subscription, check_key_availability, check_key_ant_availability, check_key_gemini_availability, check_key_azure_availability, get_azure_status, get_azure_deploy, check_key_mistral_availability, check_mistral_quota, check_key_replicate_availability, check_key_aws_availability
|
| 4 |
|
| 5 |
def sort_key(key):
|
|
@@ -29,7 +30,8 @@ def sort_key(key):
|
|
| 29 |
|
| 30 |
def get_key_oai_info(key):
|
| 31 |
# Return a dictionary containing key information
|
| 32 |
-
|
|
|
|
| 33 |
info_dict = {#"account_name": "",
|
| 34 |
"key_type": "OpenAI",
|
| 35 |
"key_availability": True if key_avai else False,
|
|
@@ -44,7 +46,7 @@ def get_key_oai_info(key):
|
|
| 44 |
#"tokens_per_minute_left": "",
|
| 45 |
"quota": ""}
|
| 46 |
if key_avai:
|
| 47 |
-
info = get_subscription(key, key_avai)
|
| 48 |
info_dict["gpt4_availability"] = info["has_gpt4"]
|
| 49 |
info_dict["gpt4_32k_availability"] = info["has_gpt4_32k"]
|
| 50 |
info_dict["default_org"] = info["default_org"]
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import anthropic
|
| 3 |
+
import requests
|
| 4 |
from api_usage import get_subscription, check_key_availability, check_key_ant_availability, check_key_gemini_availability, check_key_azure_availability, get_azure_status, get_azure_deploy, check_key_mistral_availability, check_mistral_quota, check_key_replicate_availability, check_key_aws_availability
|
| 5 |
|
| 6 |
def sort_key(key):
|
|
|
|
| 30 |
|
| 31 |
def get_key_oai_info(key):
|
| 32 |
# Return a dictionary containing key information
|
| 33 |
+
session = requests.Session()
|
| 34 |
+
key_avai = check_key_availability(session, key)
|
| 35 |
info_dict = {#"account_name": "",
|
| 36 |
"key_type": "OpenAI",
|
| 37 |
"key_availability": True if key_avai else False,
|
|
|
|
| 46 |
#"tokens_per_minute_left": "",
|
| 47 |
"quota": ""}
|
| 48 |
if key_avai:
|
| 49 |
+
info = get_subscription(key, session, key_avai)
|
| 50 |
info_dict["gpt4_availability"] = info["has_gpt4"]
|
| 51 |
info_dict["gpt4_32k_availability"] = info["has_gpt4_32k"]
|
| 52 |
info_dict["default_org"] = info["default_org"]
|