Spaces:
Running
Running
Commit
·
f7399f1
1
Parent(s):
b42cb0b
feat: implement text-to-image leaderboard in app.py, updating data source and enhancing user interface with new tab and detailed performance metrics for various providers
Browse files- app.py +32 -14
- results.jsonl → data/text_to_image.jsonl +49 -8
app.py
CHANGED
@@ -10,23 +10,28 @@ from assets import custom_css
|
|
10 |
# override method to avoid bugg
|
11 |
Leaderboard.raise_error_if_incorrect_config = lambda self: None
|
12 |
|
13 |
-
abs_path = Path(__file__).parent
|
14 |
|
15 |
# Load the JSONL file into a pandas DataFrame using the json library
|
16 |
-
with open(abs_path / "
|
17 |
json_data = file.read()
|
18 |
partially_fixed_json_data = json_data.replace("}\n{", "},\n{")
|
19 |
fixed_json_data = f"[{partially_fixed_json_data}]"
|
20 |
json_data = json.loads(fixed_json_data)
|
21 |
df = pd.DataFrame(json_data)
|
22 |
|
23 |
-
df["
|
24 |
-
lambda row: f'<a target="_blank" href="{row["URL"]}" style="color: var(--link-text-color); text-decoration: underline;text-decoration-style: dotted;">
|
25 |
axis=1,
|
26 |
)
|
27 |
df = df[
|
28 |
-
["Model", "Median Inference Time", "Price per Image"]
|
29 |
-
+ [
|
|
|
|
|
|
|
|
|
|
|
30 |
]
|
31 |
df = df.sort_values(by="GenEval", ascending=False)
|
32 |
|
@@ -41,27 +46,40 @@ with gr.Blocks("ParityError/Interstellar", fill_width=True, css=custom_css) as d
|
|
41 |
"""
|
42 |
)
|
43 |
with gr.Tabs():
|
44 |
-
with gr.TabItem("
|
45 |
Leaderboard(
|
46 |
value=df,
|
47 |
select_columns=df.columns.tolist(),
|
48 |
-
datatype=["markdown"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
)
|
50 |
with gr.TabItem("About"):
|
51 |
with gr.Row():
|
52 |
with gr.Column():
|
53 |
gr.Markdown(
|
54 |
"""
|
55 |
-
# 📊
|
56 |
|
57 |
-
|
|
|
|
|
58 |
|
59 |
- Replicate: https://replicate.com/black-forest-labs/flux-dev
|
60 |
- Fal: https://fal.ai/models/fal-ai/flux/dev
|
61 |
- Fireworks AI: https://fireworks.ai/models/fireworks/flux-1-dev-fp8
|
62 |
- Together AI: https://www.together.ai/models/flux-1-dev
|
63 |
|
64 |
-
|
|
|
|
|
|
|
|
|
65 |
|
66 |
For comparison purposes we used the same generation set-up for all the providers.
|
67 |
|
@@ -72,15 +90,15 @@ with gr.Blocks("ParityError/Interstellar", fill_width=True, css=custom_css) as d
|
|
72 |
|
73 |
Although we did test with this specific Pruna configuration and hardware, the applied compression methods work with different config and hardware too!
|
74 |
|
75 |
-
> We published a full blog post on the
|
76 |
"""
|
77 |
)
|
78 |
with gr.Column():
|
79 |
gr.Markdown(
|
80 |
"""
|
81 |
-
# 🧃 FLUX-juiced
|
82 |
|
83 |
-
FLUX-juiced is our optimized version of FLUX.1, delivering up to **2.6x faster inference** than the official Replicate API, **without sacrificing image quality**.
|
84 |
|
85 |
Under the hood, it uses a custom combination of:
|
86 |
|
|
|
10 |
# override method to avoid bugg
|
11 |
Leaderboard.raise_error_if_incorrect_config = lambda self: None
|
12 |
|
13 |
+
abs_path = Path(__file__).parent / "data"
|
14 |
|
15 |
# Load the JSONL file into a pandas DataFrame using the json library
|
16 |
+
with open(abs_path / "text_to_image.jsonl", "r") as file:
|
17 |
json_data = file.read()
|
18 |
partially_fixed_json_data = json_data.replace("}\n{", "},\n{")
|
19 |
fixed_json_data = f"[{partially_fixed_json_data}]"
|
20 |
json_data = json.loads(fixed_json_data)
|
21 |
df = pd.DataFrame(json_data)
|
22 |
|
23 |
+
df["URL"] = df.apply(
|
24 |
+
lambda row: f'<a target="_blank" href="{row["URL"]}" style="color: var(--link-text-color); text-decoration: underline;text-decoration-style: dotted;">link</a>',
|
25 |
axis=1,
|
26 |
)
|
27 |
df = df[
|
28 |
+
["URL", "Provider", "Device", "Model", "Optimization", "Median Inference Time", "Price per Image"]
|
29 |
+
+ [
|
30 |
+
col
|
31 |
+
for col in df.columns.tolist()
|
32 |
+
if col
|
33 |
+
not in ["URL", "Model", "Median Inference Time", "Price per Image", "Provider", "Device", "Optimization"]
|
34 |
+
]
|
35 |
]
|
36 |
df = df.sort_values(by="GenEval", ascending=False)
|
37 |
|
|
|
46 |
"""
|
47 |
)
|
48 |
with gr.Tabs():
|
49 |
+
with gr.TabItem("Text-to-Image Leaderboard"):
|
50 |
Leaderboard(
|
51 |
value=df,
|
52 |
select_columns=df.columns.tolist(),
|
53 |
+
datatype=["markdown", "markdown", "markdown", "markdown", "markdown"]
|
54 |
+
+ ["number"] * (len(df.columns.tolist()) - 5),
|
55 |
+
filter_columns=[
|
56 |
+
"Provider",
|
57 |
+
"Device",
|
58 |
+
"Model",
|
59 |
+
"Optimization",
|
60 |
+
],
|
61 |
)
|
62 |
with gr.TabItem("About"):
|
63 |
with gr.Row():
|
64 |
with gr.Column():
|
65 |
gr.Markdown(
|
66 |
"""
|
67 |
+
# 📊 Text-to-Image Leaderboard
|
68 |
|
69 |
+
This leaderboard compares the performance of different text-to-image providers.
|
70 |
+
|
71 |
+
We started with a comprehensive benchmark comparing our very own FLUX-juiced with the “FLUX.1 [dev]” endpoints offered by:
|
72 |
|
73 |
- Replicate: https://replicate.com/black-forest-labs/flux-dev
|
74 |
- Fal: https://fal.ai/models/fal-ai/flux/dev
|
75 |
- Fireworks AI: https://fireworks.ai/models/fireworks/flux-1-dev-fp8
|
76 |
- Together AI: https://www.together.ai/models/flux-1-dev
|
77 |
|
78 |
+
We also included the following non-FLUX providers:
|
79 |
+
|
80 |
+
- AWS Nova Canvas: https://aws.amazon.com/ai/generative-ai/nova/creative/
|
81 |
+
|
82 |
+
All of these inference providers offer implementations but they don’t always communicate about the optimisation methods used in the background, and most endpoint have different response times and performance measures.
|
83 |
|
84 |
For comparison purposes we used the same generation set-up for all the providers.
|
85 |
|
|
|
90 |
|
91 |
Although we did test with this specific Pruna configuration and hardware, the applied compression methods work with different config and hardware too!
|
92 |
|
93 |
+
> We published a full blog post on [the creation of our FLUX-juiced endpoint](https://www.pruna.ai/blog/flux-juiced-the-fastest-image-generation-endpoint).
|
94 |
"""
|
95 |
)
|
96 |
with gr.Column():
|
97 |
gr.Markdown(
|
98 |
"""
|
99 |
+
# 🧃 FLUX.1-dev (juiced)
|
100 |
|
101 |
+
FLUX.1-dev (juiced) is our optimized version of FLUX.1-dev, delivering up to **2.6x faster inference** than the official Replicate API, **without sacrificing image quality**.
|
102 |
|
103 |
Under the hood, it uses a custom combination of:
|
104 |
|
results.jsonl → data/text_to_image.jsonl
RENAMED
@@ -1,5 +1,8 @@
|
|
1 |
{
|
2 |
-
"
|
|
|
|
|
|
|
3 |
"URL": "https://huggingface.co/black-forest-labs/FLUX.1-dev?library=diffusers",
|
4 |
"GenEval": 67.98,
|
5 |
"HPS (v2.1)": 30.36,
|
@@ -13,7 +16,10 @@
|
|
13 |
"Price per Image": 0.025
|
14 |
}
|
15 |
{
|
16 |
-
"
|
|
|
|
|
|
|
17 |
"URL": "https://fal.ai/models/fal-ai/flux/dev",
|
18 |
"GenEval": 68.72,
|
19 |
"HPS (v2.1)": 29.97,
|
@@ -27,7 +33,10 @@
|
|
27 |
"Price per Image": 0.025
|
28 |
}
|
29 |
{
|
30 |
-
"
|
|
|
|
|
|
|
31 |
"URL": "https://fireworks.ai/models/fireworks/flux-1-dev-fp8",
|
32 |
"GenEval": 65.55,
|
33 |
"HPS (v2.1)": 30.26,
|
@@ -41,7 +50,10 @@
|
|
41 |
"Price per Image": 0.014
|
42 |
}
|
43 |
{
|
44 |
-
"
|
|
|
|
|
|
|
45 |
"URL": "https://replicate.com/prunaai/flux.1-juiced",
|
46 |
"GenEval": 69.9,
|
47 |
"HPS (v2.1)": 29.86,
|
@@ -55,7 +67,10 @@
|
|
55 |
"Price per Image": 0.004
|
56 |
}
|
57 |
{
|
58 |
-
"
|
|
|
|
|
|
|
59 |
"URL": "https://replicate.com/prunaai/flux.1-juiced",
|
60 |
"GenEval": 68.64,
|
61 |
"HPS (v2.1)": 30.38,
|
@@ -69,7 +84,10 @@
|
|
69 |
"Price per Image": 0.0048
|
70 |
}
|
71 |
{
|
72 |
-
"
|
|
|
|
|
|
|
73 |
"URL": "https://replicate.com/prunaai/flux.1-lightly-juiced",
|
74 |
"GenEval": 69.12,
|
75 |
"HPS (v2.1)": 30.36,
|
@@ -83,7 +101,10 @@
|
|
83 |
"Price per Image": 0.0054
|
84 |
}
|
85 |
{
|
86 |
-
"
|
|
|
|
|
|
|
87 |
"URL": "https://replicate.com/black-forest-labs/flux-dev",
|
88 |
"GenEval": 67.41,
|
89 |
"HPS (v2.1)": 29.25,
|
@@ -97,7 +118,10 @@
|
|
97 |
"Price per Image": 0.025
|
98 |
}
|
99 |
{
|
100 |
-
"
|
|
|
|
|
|
|
101 |
"URL": "https://www.together.ai/models/flux-1-dev",
|
102 |
"GenEval": 64.61,
|
103 |
"HPS (v2.1)": 30.22,
|
@@ -110,3 +134,20 @@
|
|
110 |
"Median Inference Time": 3.38,
|
111 |
"Price per Image": 0.025
|
112 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
{
|
2 |
+
"Provider": "Black Forest Labs",
|
3 |
+
"Device": "H100",
|
4 |
+
"Model": "FLUX.1-dev",
|
5 |
+
"Optimization": "none",
|
6 |
"URL": "https://huggingface.co/black-forest-labs/FLUX.1-dev?library=diffusers",
|
7 |
"GenEval": 67.98,
|
8 |
"HPS (v2.1)": 30.36,
|
|
|
16 |
"Price per Image": 0.025
|
17 |
}
|
18 |
{
|
19 |
+
"Provider": "fal.ai",
|
20 |
+
"Device": "Serverless",
|
21 |
+
"Model": "FLUX.1-dev",
|
22 |
+
"Optimization": "custom",
|
23 |
"URL": "https://fal.ai/models/fal-ai/flux/dev",
|
24 |
"GenEval": 68.72,
|
25 |
"HPS (v2.1)": 29.97,
|
|
|
33 |
"Price per Image": 0.025
|
34 |
}
|
35 |
{
|
36 |
+
"Provider": "Fireworks AI",
|
37 |
+
"Device": "Serverless",
|
38 |
+
"Model": "FLUX.1-dev",
|
39 |
+
"Optimization": "fp8",
|
40 |
"URL": "https://fireworks.ai/models/fireworks/flux-1-dev-fp8",
|
41 |
"GenEval": 65.55,
|
42 |
"HPS (v2.1)": 30.26,
|
|
|
50 |
"Price per Image": 0.014
|
51 |
}
|
52 |
{
|
53 |
+
"Provider": "Pruna AI",
|
54 |
+
"Device": "H100",
|
55 |
+
"Model": "FLUX.1-dev",
|
56 |
+
"Optimization": "extra juiced",
|
57 |
"URL": "https://replicate.com/prunaai/flux.1-juiced",
|
58 |
"GenEval": 69.9,
|
59 |
"HPS (v2.1)": 29.86,
|
|
|
67 |
"Price per Image": 0.004
|
68 |
}
|
69 |
{
|
70 |
+
"Provider": "Pruna AI",
|
71 |
+
"Device": "H100",
|
72 |
+
"Model": "FLUX.1-dev",
|
73 |
+
"Optimization": "juiced",
|
74 |
"URL": "https://replicate.com/prunaai/flux.1-juiced",
|
75 |
"GenEval": 68.64,
|
76 |
"HPS (v2.1)": 30.38,
|
|
|
84 |
"Price per Image": 0.0048
|
85 |
}
|
86 |
{
|
87 |
+
"Provider": "Pruna AI",
|
88 |
+
"Device": "H100",
|
89 |
+
"Model": "FLUX.1-dev",
|
90 |
+
"Optimization": "lightly juiced",
|
91 |
"URL": "https://replicate.com/prunaai/flux.1-lightly-juiced",
|
92 |
"GenEval": 69.12,
|
93 |
"HPS (v2.1)": 30.36,
|
|
|
101 |
"Price per Image": 0.0054
|
102 |
}
|
103 |
{
|
104 |
+
"Provider": "Black Forest Labs",
|
105 |
+
"Device": "H100",
|
106 |
+
"Model": "FLUX.1-dev",
|
107 |
+
"Optimization": "go_fast",
|
108 |
"URL": "https://replicate.com/black-forest-labs/flux-dev",
|
109 |
"GenEval": 67.41,
|
110 |
"HPS (v2.1)": 29.25,
|
|
|
118 |
"Price per Image": 0.025
|
119 |
}
|
120 |
{
|
121 |
+
"Provider": "Together AI",
|
122 |
+
"Device": "Serverless",
|
123 |
+
"Model": "FLUX.1-dev",
|
124 |
+
"Optimization": "unsure",
|
125 |
"URL": "https://www.together.ai/models/flux-1-dev",
|
126 |
"GenEval": 64.61,
|
127 |
"HPS (v2.1)": 30.22,
|
|
|
134 |
"Median Inference Time": 3.38,
|
135 |
"Price per Image": 0.025
|
136 |
}
|
137 |
+
{
|
138 |
+
"Provider": "AWS",
|
139 |
+
"Device": "Serverless",
|
140 |
+
"Model": "AWS Nova Canvas",
|
141 |
+
"Optimization": "unsure",
|
142 |
+
"URL": "https://aws.amazon.com/ai/generative-ai/nova/creative/",
|
143 |
+
"GenEval": null,
|
144 |
+
"HPS (v2.1)": null,
|
145 |
+
"GenAI-Bench (VQA)": null,
|
146 |
+
"DrawBench (Image Reward)": 1.07,
|
147 |
+
"PartiPromts (ARNIQA)": 0.65,
|
148 |
+
"PartiPromts (ClipIQA)": 0.954,
|
149 |
+
"PartiPromts (ClipScore)": 28.1,
|
150 |
+
"PartiPromts (Sharpness - Laplacian Variance)": 10514,
|
151 |
+
"Median Inference Time": 3.65,
|
152 |
+
"Price per Image": null
|
153 |
+
}
|