Spaces:
Sleeping
Sleeping
File size: 6,082 Bytes
03263ac 4cba650 75361de 03263ac 73fd05b 03263ac 6903420 03263ac 6903420 03263ac 6903420 03263ac 6903420 03263ac 6903420 03263ac 6903420 03263ac 6903420 03263ac 6903420 03263ac 6903420 03263ac 6903420 03263ac 6903420 03263ac 6903420 03263ac 6903420 03263ac 6903420 03263ac 6903420 03263ac 6903420 03263ac 6903420 03263ac 6903420 03263ac 6903420 03263ac 6903420 03263ac 6903420 03263ac 6903420 03263ac 6903420 03263ac 6903420 03263ac 73fd05b 32b5f27 8601e54 32b5f27 4cba650 32b5f27 4cba650 32b5f27 4cba650 32b5f27 4cba650 32b5f27 |
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 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
import gradio as gr
# Fireworks AI Model Configuration
EMBEDDING_MODEL = "accounts/fireworks/models/qwen3-embedding-8b"
LLM_MODEL = "accounts/fireworks/models/qwen3-8b"
RERANKER_MODEL = "accounts/fireworks/models/qwen3-reranker-8b"
GRADIO_THEME = gr.themes.Base(
primary_hue=gr.themes.colors.purple,
secondary_hue=gr.themes.colors.violet,
neutral_hue=gr.themes.colors.slate,
spacing_size=gr.themes.sizes.spacing_lg,
radius_size=gr.themes.sizes.radius_md,
text_size=gr.themes.sizes.text_md,
font=[gr.themes.GoogleFont("Inter"), "ui-sans-serif", "system-ui", "sans-serif"],
font_mono=[gr.themes.GoogleFont("JetBrains Mono"), "monospace"],
).set(
button_primary_background_fill="#6720FF",
button_primary_background_fill_hover="#7B2FFF",
button_primary_text_color="#FFFFFF",
button_secondary_background_fill="#F3F0FF",
button_secondary_background_fill_hover="#EDE9FE",
button_secondary_text_color="#6720FF",
slider_color="#6720FF",
link_text_color="#6720FF",
link_text_color_hover="#7B2FFF",
link_text_color_visited="#8B5CF6",
body_background_fill="#FAFBFC",
block_background_fill="#FFFFFF",
input_background_fill="#FFFFFF",
border_color_primary="#E6EAF4",
)
CUSTOM_CSS = """
.gradio-container {
font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
background: linear-gradient(135deg, #FAFBFC 0%, #F3F0FF 100%);
}
.header-title {
background: linear-gradient(135deg, #6720FF 0%, #8B5CF6 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
font-weight: 700;
text-align: center;
margin-bottom: 0.5em;
}
.subtitle {
color: #64748B;
text-align: center;
font-size: 1.1em;
margin-top: 0;
}
.search-box {
border: 2px solid #E6EAF4;
border-radius: 10px;
transition: all 0.2s ease;
}
.search-box:focus {
border-color: #6720FF;
box-shadow: 0 0 0 3px rgba(103, 32, 255, 0.1);
}
.result-card {
background: white;
border-radius: 12px;
padding: 18px;
margin: 10px 0;
box-shadow: 0 2px 6px rgba(103, 32, 255, 0.08);
border: 1px solid #E6EAF4;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.result-card:hover {
transform: translateY(-2px);
box-shadow: 0 6px 16px rgba(103, 32, 255, 0.15);
border-color: #C4B5FD;
}
.metric-box {
background: linear-gradient(135deg, #F3F0FF 0%, #FFFFFF 100%);
border-left: 4px solid #6720FF;
padding: 16px;
margin: 8px 0;
border-radius: 10px;
font-size: 0.9em;
box-shadow: 0 2px 4px rgba(103, 32, 255, 0.05);
}
.code-section {
background: linear-gradient(135deg, #F3F0FF 0%, #FFFFFF 100%);
border-left: 4px solid #6720FF;
padding: 18px;
margin: 12px 0;
border-radius: 10px;
font-family: 'JetBrains Mono', monospace;
font-size: 0.9em;
}
.comparison-table {
width: 100%;
border-collapse: collapse;
margin: 20px 0;
box-shadow: 0 2px 8px rgba(103, 32, 255, 0.08);
border-radius: 10px;
overflow: hidden;
}
.comparison-table th {
background: linear-gradient(135deg, #6720FF 0%, #7B2FFF 100%);
color: white;
padding: 14px;
text-align: left;
font-weight: 600;
text-transform: uppercase;
font-size: 0.85em;
letter-spacing: 0.5px;
}
.comparison-table td {
padding: 14px;
border-bottom: 1px solid #E6EAF4;
background: white;
}
.comparison-table tr:hover td {
background: #F8F7FF;
}
.comparison-table tr:last-child td {
border-bottom: none;
}
::-webkit-scrollbar {
width: 10px;
height: 10px;
}
::-webkit-scrollbar-track {
background: #F3F0FF;
border-radius: 5px;
}
::-webkit-scrollbar-thumb {
background: linear-gradient(135deg, #C4B5FD 0%, #A78BFA 100%);
border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
background: linear-gradient(135deg, #A78BFA 0%, #8B5CF6 100%);
}
details {
border: 1px solid #E6EAF4;
border-radius: 12px;
padding: 14px;
margin: 12px 0;
background: white;
transition: all 0.3s ease;
}
details[open] {
border-color: #C4B5FD;
box-shadow: 0 4px 16px rgba(103, 32, 255, 0.12);
}
summary {
font-weight: 600;
color: #6720FF;
cursor: pointer;
padding: 6px;
user-select: none;
transition: color 0.2s ease;
}
summary:hover {
color: #7B2FFF;
}
.logo-image {
display: flex;
justify-content: flex-end;
align-items: center;
}
.api-config-accordion {
margin: 10px 0;
padding: 0;
}
.api-config-accordion > .label-wrap {
font-size: 0.85em;
padding: 8px 12px;
}
/* Tab styling */
.tabs button {
transition: all 0.2s ease;
}
.tabs button[aria-selected="true"] {
border-bottom: 3px solid #6720FF !important;
}
/* Button enhancements */
button.primary {
background: linear-gradient(135deg, #6720FF 0%, #7B2FFF 100%) !important;
transition: all 0.3s ease !important;
}
button.primary:hover {
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(103, 32, 255, 0.25) !important;
}
"""
EXAMPLE_QUERIES_BY_CATEGORY = {
"Baby Products": {
"clear": "nursery wall decor quotes motivational stickers",
"somewhat_ambiguous": "baby room essentials",
"ambiguous": "expecting soon",
},
"Toys & Games": {
"clear": "magnetic construction building blocks educational toy",
"somewhat_ambiguous": "creative play for young children",
"ambiguous": "keep kids busy",
},
"Home & Kitchen": {
"clear": "kids octopus comforter bedding set full size",
"somewhat_ambiguous": "cozy items for child's room",
"ambiguous": "make bedroom nicer",
},
"Clothing, Shoes & Jewelry": {
"clear": "star wars stormtrooper halloween costume kids",
"somewhat_ambiguous": "pretend play clothing",
"ambiguous": "halloween party",
},
"Sports & Outdoors": {
"clear": "55 inch trampoline with safety net enclosure",
"somewhat_ambiguous": "active outdoor toy",
"ambiguous": "yard activity",
},
}
|