Website url
Browse files
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import asyncio
|
| 3 |
import tokonomics
|
| 4 |
-
from utils import
|
| 5 |
|
| 6 |
st.set_page_config(page_title="LLM Pricing App", layout="wide")
|
| 7 |
|
|
@@ -52,7 +52,8 @@ def estimate_cost(num_alerts, input_size, output_size, model_id):
|
|
| 52 |
return "NA"
|
| 53 |
input_tokens = round(input_size * 1.3)
|
| 54 |
output_tokens = round(output_size * 1.3)
|
| 55 |
-
price_day = cost_token.get("input_cost_per_token", 0) * input_tokens +
|
|
|
|
| 56 |
price_total = price_day * num_alerts
|
| 57 |
return f"""## Estimated Cost:
|
| 58 |
|
|
@@ -76,11 +77,15 @@ if "data_loaded" not in st.session_state:
|
|
| 76 |
# Sidebar
|
| 77 |
# --------------------------
|
| 78 |
with st.sidebar:
|
| 79 |
-
st.image("https://cdn.prod.website-files.com/630f558f2a15ca1e88a2f774/631f1436ad7a0605fecc5e15_Logo.svg",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
st.divider()
|
| 81 |
st.sidebar.title("LLM Pricing Calculator")
|
| 82 |
|
| 83 |
-
|
| 84 |
# --------------------------
|
| 85 |
# Main Content Layout (Model Selection Tab)
|
| 86 |
# --------------------------
|
|
@@ -92,13 +97,25 @@ with tab1:
|
|
| 92 |
# --- Row 1: Provider/Type and Model Selection ---
|
| 93 |
col_left, col_right = st.columns(2)
|
| 94 |
with col_left:
|
| 95 |
-
selected_provider = st.selectbox(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
selected_type = st.radio("Select type", options=["text", "image"], index=0)
|
|
|
|
| 97 |
with col_right:
|
| 98 |
# Filter models based on the selected provider and type
|
| 99 |
filtered_models = provider_change(selected_provider, selected_type)
|
|
|
|
| 100 |
if filtered_models:
|
| 101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
else:
|
| 103 |
selected_model = None
|
| 104 |
st.write("No models available")
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import asyncio
|
| 3 |
import tokonomics
|
| 4 |
+
from utils import create_model_hierarchy
|
| 5 |
|
| 6 |
st.set_page_config(page_title="LLM Pricing App", layout="wide")
|
| 7 |
|
|
|
|
| 52 |
return "NA"
|
| 53 |
input_tokens = round(input_size * 1.3)
|
| 54 |
output_tokens = round(output_size * 1.3)
|
| 55 |
+
price_day = cost_token.get("input_cost_per_token", 0) * input_tokens + \
|
| 56 |
+
cost_token.get("output_cost_per_token", 0) * output_tokens
|
| 57 |
price_total = price_day * num_alerts
|
| 58 |
return f"""## Estimated Cost:
|
| 59 |
|
|
|
|
| 77 |
# Sidebar
|
| 78 |
# --------------------------
|
| 79 |
with st.sidebar:
|
| 80 |
+
st.image("https://cdn.prod.website-files.com/630f558f2a15ca1e88a2f774/631f1436ad7a0605fecc5e15_Logo.svg",
|
| 81 |
+
use_container_width=True)
|
| 82 |
+
st.markdown(
|
| 83 |
+
""" Visit: [https://www.priam.ai](https://www.priam.ai)
|
| 84 |
+
"""
|
| 85 |
+
)
|
| 86 |
st.divider()
|
| 87 |
st.sidebar.title("LLM Pricing Calculator")
|
| 88 |
|
|
|
|
| 89 |
# --------------------------
|
| 90 |
# Main Content Layout (Model Selection Tab)
|
| 91 |
# --------------------------
|
|
|
|
| 97 |
# --- Row 1: Provider/Type and Model Selection ---
|
| 98 |
col_left, col_right = st.columns(2)
|
| 99 |
with col_left:
|
| 100 |
+
selected_provider = st.selectbox(
|
| 101 |
+
"Select a provider",
|
| 102 |
+
st.session_state["providers"],
|
| 103 |
+
index=st.session_state["providers"].index("azure") if "azure" in st.session_state["providers"] else 0
|
| 104 |
+
)
|
| 105 |
selected_type = st.radio("Select type", options=["text", "image"], index=0)
|
| 106 |
+
|
| 107 |
with col_right:
|
| 108 |
# Filter models based on the selected provider and type
|
| 109 |
filtered_models = provider_change(selected_provider, selected_type)
|
| 110 |
+
|
| 111 |
if filtered_models:
|
| 112 |
+
# Force "gpt-4-turbo" as default if available; otherwise, default to the first model.
|
| 113 |
+
default_model = "o1" if "o1" in filtered_models else filtered_models[0]
|
| 114 |
+
selected_model = st.selectbox(
|
| 115 |
+
"Select a model",
|
| 116 |
+
options=filtered_models,
|
| 117 |
+
index=filtered_models.index(default_model)
|
| 118 |
+
)
|
| 119 |
else:
|
| 120 |
selected_model = None
|
| 121 |
st.write("No models available")
|