File size: 6,523 Bytes
41a091f 31011f4 41a091f 31011f4 41a091f 8721991 41a091f 31011f4 8721991 41a091f 8721991 41a091f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
import gradio as gr
import pandas as pd
# 데이터를 pandas DataFrame으로 변환
mockData = [
{
'provider': 'OpenAI',
'uri': 'https://openai.com/api/pricing/',
'models': [
{'name': 'GPT-4o', 'inputPrice': 5.0, 'outputPrice': 15.0},
{'name': 'GPT-4 (8K)', 'inputPrice': 30.0, 'outputPrice': 60.0},
{'name': 'GPT-4 Turbo', 'inputPrice': 10.0, 'outputPrice': 30.0},
{'name': 'GPT-3.5-turbo', 'inputPrice': 0.5, 'outputPrice': 1.5},
],
},
{
'provider': 'Anthropic',
'uri': 'https://www.anthropic.com/pricing',
'models': [
{'name': 'Claude 3 (Opus)', 'inputPrice': 15.0, 'outputPrice': 75.0},
{'name': 'Claude 3.5 (Sonnet)', 'inputPrice': 3.0, 'outputPrice': 15.0},
{'name': 'Claude 3 (Haiku)', 'inputPrice': 0.25, 'outputPrice': 1.25},
],
},
{
'provider': 'Google',
'uri': 'https://ai.google.dev/pricing?hl=en',
'models': [
{'name': 'Gemini 1.5 Pro', 'inputPrice': 3.5, 'outputPrice': 7.0},
{'name': 'Gemini 1.5 Flash', 'inputPrice': 0.35, 'outputPrice': 0.7},
],
},
{
'provider': 'Cohere',
'uri': 'https://cohere.com/pricing',
'models': [
{'name': 'Command R+', 'inputPrice': 3.0, 'outputPrice': 15.0},
{'name': 'Command R', 'inputPrice': 0.5, 'outputPrice': 1.5},
],
},
{
'provider': 'Mistral',
'uri': 'https://docs.mistral.ai/platform/pricing',
'models': [
{'name': 'mistral-large-2402', 'inputPrice': 4.0, 'outputPrice': 12.0},
{'name': 'codestral-2405', 'inputPrice': 1.0, 'outputPrice': 3.0},
{'name': 'Mixtral 8x22B', 'inputPrice': 2.0, 'outputPrice': 6.0},
{'name': 'Mixtral 8x7B', 'inputPrice': 0.7, 'outputPrice': 0.7},
],
},
{
'provider': 'Deepspeek',
'uri': 'https://platform.deepseek.com/api-docs/pricing/',
'models': [
{'name': 'deepseek-chat', 'inputPrice': 0.14, 'outputPrice': 0.28},
{'name': 'deepseek-coder', 'inputPrice': 0.14, 'outputPrice': 0.28},
],
},
{
'provider': 'Anyscale',
'uri': 'https://www.anyscale.com/pricing-detail',
'models': [
{'name': 'Mixtral 8x7B', 'inputPrice': 0.5, 'outputPrice': 0.5},
{'name': 'Llama 3 70b', 'inputPrice': 1.0, 'outputPrice': 1.0},
],
},
{
'provider': 'Together.AI',
'uri': 'https://www.together.ai/pricing',
'models': [
{'name': 'Mixtral 8x7B', 'inputPrice': 0.6, 'outputPrice': 0.6},
{'name': 'Llama 3 70b', 'inputPrice': 0.9, 'outputPrice': 0.9},
],
},
{
'provider': 'Replicate',
'uri': 'https://replicate.com/pricing',
'models': [
{'name': 'Llama 3 70b', 'inputPrice': 0.65, 'outputPrice': 2.75},
{'name': 'Mixtral 8x7B', 'inputPrice': 0.30, 'outputPrice': 1.00},
],
},
{
'provider': 'IBM WatsonX',
'uri': 'https://www.ibm.com/products/watsonx-ai/foundation-models',
'models': [
{'name': 'Llama 3 70b', 'inputPrice': 1.80, 'outputPrice': 1.80},
],
},
{
'provider': 'Groq',
'uri': 'https://wow.groq.com/',
'models': [
{'name': 'Llama 3 70b', 'inputPrice': 0.59, 'outputPrice': 0.79},
{'name': 'Mixtral 8x7B', 'inputPrice': 0.24, 'outputPrice': 0.24},
],
},
{
'provider': 'Fireworks',
'uri': 'https://fireworks.ai/pricing',
'models': [
{'name': 'Llama 3 70b', 'inputPrice': 0.90, 'outputPrice': 0.90},
{'name': 'Mixtral 8x7B', 'inputPrice': 0.50, 'outputPrice': 0.50},
],
},
{
'provider': '01.ai',
'uri': 'https://platform.01.ai/docs#models-and-pricing',
'models': [
{'name': 'Yi-Large', 'inputPrice': 3.00, 'outputPrice': 3.00},
],
},
{
'provider': 'Perplexity',
'uri': 'https://docs.perplexity.ai/docs/pricing',
'models': [
{'name': 'Llama 3 70b', 'inputPrice': 1.0, 'outputPrice': 1.0},
{'name': 'Mixtral 8x7B', 'inputPrice': 0.60, 'outputPrice': 0.60},
],
},
{
'provider': 'OpenFreeAI',
'uri': 'https://discord.gg/openfreeai',
'models': [
{'name': 'kAI', 'inputPrice': 0, 'outputPrice': 0},
{'name': 'Llama 3 70b', 'inputPrice': 0, 'outputPrice': 0},
{'name': 'Llama 3 8b', 'inputPrice': 0, 'outputPrice': 0},
{'name': 'Mixtral 8x7B', 'inputPrice': 0, 'outputPrice': 0},
],
},
{
'provider': 'Writer',
'uri': 'https://dev.writer.com/home/pricing',
'models': [
{'name': 'Palmyra X 003', 'inputPrice': 7.50, 'outputPrice': 22.50},
{'name': 'Palmyra X 32k', 'inputPrice': 1.0, 'outputPrice': 2.0},
{'name': 'Palmyra X 002', 'inputPrice': 1.0, 'outputPrice': 2.0},
{'name': 'Palmyra X 002 32k', 'inputPrice': 1.0, 'outputPrice': 2.0}
],
}
]
# DataFrame으로 변환
data = []
for provider in mockData:
for model in provider['models']:
total_price = model['inputPrice'] + model['outputPrice']
data.append({
'Provider': provider['provider'],
'URI': provider['uri'],
'Model': model['name'],
'Total Price': total_price,
'Input Price': model['inputPrice'],
'Output Price': model['outputPrice']
})
df = pd.DataFrame(data)
# Function to sort the data based on a column
def sort_data(column, ascending=True):
return df.sort_values(by=column, ascending=ascending)
# Gradio interface to display and interact with the data
def update_table(column, ascending):
sorted_df = sort_data(column, ascending)
return sorted_df
with gr.Blocks() as demo:
gr.Markdown("# Comparison of LLM (Large Language Model) Costs Based on One Million Tokens")
column = gr.Dropdown(label="Select column to sort by", choices=df.columns.tolist(), default="Total Price")
ascending = gr.Checkbox(label="Ascending order", value=True)
sort_button = gr.Button("Sort")
table = gr.Dataframe(df)
sort_button.click(fn=update_table, inputs=[column, ascending], outputs=table)
# Run the application
if __name__ == "__main__":
demo.launch() |