Commit
·
beff183
1
Parent(s):
21050e2
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import openai
|
| 3 |
-
from api_usage import check_gpt4_availability, get_subscription, check_key_availability #, get_usage
|
| 4 |
|
| 5 |
def get_key_info(key):
|
| 6 |
# Return a dictionary containing key information
|
|
@@ -9,22 +9,31 @@ def get_key_info(key):
|
|
| 9 |
info_dict = {"account_name": "",
|
| 10 |
"key_availability": key_avai,
|
| 11 |
"gpt4_availability": "",
|
| 12 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
# "used": "",
|
| 14 |
-
"plan": "",
|
| 15 |
-
"soft_limit": "",
|
| 16 |
-
"hard_limit": ""}
|
| 17 |
if key_avai:
|
| 18 |
info = get_subscription(key)
|
| 19 |
# used = get_usage(key)
|
| 20 |
gpt4_avai = check_gpt4_availability()
|
| 21 |
-
|
|
|
|
| 22 |
info_dict["gpt4_availability"] = gpt4_avai
|
| 23 |
-
info_dict["
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
# info_dict["used"] = used
|
| 25 |
-
info_dict["plan"] = info["plan"]
|
| 26 |
-
info_dict["soft_limit"] = info["soft_limit_usd"]
|
| 27 |
-
info_dict["hard_limit"] = info["hard_limit_usd"]
|
| 28 |
return info_dict
|
| 29 |
|
| 30 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import openai
|
| 3 |
+
from api_usage import check_gpt4_availability, check_gpt4_32k_availability, get_subscription, check_key_availability #, get_usage
|
| 4 |
|
| 5 |
def get_key_info(key):
|
| 6 |
# Return a dictionary containing key information
|
|
|
|
| 9 |
info_dict = {"account_name": "",
|
| 10 |
"key_availability": key_avai,
|
| 11 |
"gpt4_availability": "",
|
| 12 |
+
"gpt4_32k_availability": "",
|
| 13 |
+
"rpm": "",
|
| 14 |
+
"organization": ""
|
| 15 |
+
"quota": ""}
|
| 16 |
+
# "has_payment_method": "",
|
| 17 |
# "used": "",
|
| 18 |
+
# "plan": "",
|
| 19 |
+
# "soft_limit": "",
|
| 20 |
+
# "hard_limit": ""}
|
| 21 |
if key_avai:
|
| 22 |
info = get_subscription(key)
|
| 23 |
# used = get_usage(key)
|
| 24 |
gpt4_avai = check_gpt4_availability()
|
| 25 |
+
gpt4_32k_avai = check_gpt4_32k_availability()
|
| 26 |
+
# info_dict["account_name"] = info["account_name"]
|
| 27 |
info_dict["gpt4_availability"] = gpt4_avai
|
| 28 |
+
info_dict["gpt4_32k_availability"] = gpt4_32k_avai
|
| 29 |
+
info_dict["rpm"] = info["rpm"] + " (gpt4)" if gpt4_avai else info["rpm"] + " (turbo)"
|
| 30 |
+
info_dict["organization"] = info["organization"]
|
| 31 |
+
info_dict["quota"] = info["quota"]
|
| 32 |
+
# info_dict["has_payment_method"] = info["has_payment_method"]
|
| 33 |
# info_dict["used"] = used
|
| 34 |
+
# info_dict["plan"] = info["plan"]
|
| 35 |
+
# info_dict["soft_limit"] = info["soft_limit_usd"]
|
| 36 |
+
# info_dict["hard_limit"] = info["hard_limit_usd"]
|
| 37 |
return info_dict
|
| 38 |
|
| 39 |
|