Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -152,20 +152,6 @@ class GradioInterface:
|
|
152 |
def __init__(self, prompt_refiner: PromptRefiner):
|
153 |
self.prompt_refiner = prompt_refiner
|
154 |
custom_css = """
|
155 |
-
/*
|
156 |
-
.gradio-container {
|
157 |
-
background-color: #e3f2fd !important;
|
158 |
-
}
|
159 |
-
|
160 |
-
.gradio-container > div:first-child {
|
161 |
-
background-image: url('https://huggingface.co/spaces/baconnier/prompt-plus-plus/resolve/main/prompt_plus_plus.jpg');
|
162 |
-
background-size: cover;
|
163 |
-
background-position: center;
|
164 |
-
background-repeat: no-repeat;
|
165 |
-
background-color: rgba(255, 255, 255, 0.05);
|
166 |
-
background-blend-mode: overlay;
|
167 |
-
}
|
168 |
-
*/
|
169 |
.container {
|
170 |
border: 2px solid #2196F3;
|
171 |
border-radius: 10px;
|
@@ -173,15 +159,11 @@ class GradioInterface:
|
|
173 |
margin: 6px;
|
174 |
background: white;
|
175 |
position: relative;
|
|
|
|
|
|
|
176 |
}
|
177 |
-
|
178 |
-
border: 2px solid #CBDCEB;
|
179 |
-
border-radius: 10px;
|
180 |
-
padding: 12px;
|
181 |
-
margin: 6px;
|
182 |
-
background: white;
|
183 |
-
position: relative;
|
184 |
-
}
|
185 |
.container::before {
|
186 |
position: absolute;
|
187 |
top: -10px;
|
@@ -192,10 +174,26 @@ class GradioInterface:
|
|
192 |
font-weight: bold;
|
193 |
font-size: 1.2em;
|
194 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
.title-container {
|
196 |
width: fit-content !important;
|
197 |
margin: 0 auto !important;
|
198 |
-
padding: 2px 40px !important;
|
199 |
border: 1px solid #0066cc !important;
|
200 |
border-radius: 10px !important;
|
201 |
background-color: rgba(0, 102, 204, 0.05) !important;
|
@@ -203,11 +201,10 @@ class GradioInterface:
|
|
203 |
|
204 |
.title-container * {
|
205 |
text-align: center;
|
206 |
-
margin: 0 !important;
|
207 |
-
line-height: 1 !important;
|
208 |
}
|
209 |
|
210 |
-
/* Specific size adjustments for each text element */
|
211 |
.title-container h1 {
|
212 |
font-size: 28px !important;
|
213 |
margin-bottom: 1px !important;
|
@@ -222,16 +219,48 @@ class GradioInterface:
|
|
222 |
font-size: 14px !important;
|
223 |
margin-bottom: 1px !important;
|
224 |
}
|
225 |
-
|
226 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
display: flex !important;
|
228 |
gap: 8px !important;
|
|
|
|
|
229 |
}
|
230 |
|
231 |
-
/* Style for radio button labels */
|
232 |
.gradio-radio label {
|
233 |
-
display: flex !important;
|
234 |
-
align-items: center !important;
|
235 |
padding: 6px 12px !important;
|
236 |
border: 1px solid #ddd !important;
|
237 |
border-radius: 4px !important;
|
@@ -239,66 +268,43 @@ class GradioInterface:
|
|
239 |
background: white !important;
|
240 |
}
|
241 |
|
242 |
-
/* Style for selected radio button */
|
243 |
.gradio-radio input[type="radio"]:checked + label {
|
244 |
background: #e3f2fd !important;
|
245 |
border-color: #2196F3 !important;
|
246 |
color: #2196F3 !important;
|
247 |
-
font-weight: bold !important;
|
248 |
-
}
|
249 |
-
|
250 |
-
/* Container labels */
|
251 |
-
.title-container::before { content: ''; }
|
252 |
-
.input-container::before { content: 'PROMPT REFINEMENT'; }
|
253 |
-
.analysis-container::before { content: 'ANALYSIS & REFINEMENT'; }
|
254 |
-
.model-container::before { content: 'PROMPTS APPLICATION'; }
|
255 |
-
.results-container::before { content: 'RESULTS'; }
|
256 |
-
.examples-container::before { content: 'Examples'; }
|
257 |
-
|
258 |
-
/* Radio group styling */
|
259 |
-
.radio-group {
|
260 |
-
display: flex;
|
261 |
-
gap: 8px;
|
262 |
-
margin: 6px 0;
|
263 |
}
|
264 |
|
265 |
-
/*
|
266 |
-
.gradio-
|
267 |
-
.gradio-container textarea,
|
268 |
-
.gradio-container select {
|
269 |
border: 1px solid #ddd !important;
|
270 |
-
background: white !important;
|
271 |
border-radius: 4px !important;
|
|
|
|
|
272 |
}
|
273 |
|
274 |
-
/*
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
border-radius: 50% !important;
|
282 |
-
margin-right: 6px !important;
|
283 |
-
position: relative !important;
|
284 |
-
top: 2px !important;
|
285 |
}
|
286 |
|
287 |
-
|
288 |
-
|
289 |
-
|
|
|
290 |
}
|
291 |
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
left: 50% !important;
|
301 |
-
transform: translate(-50%, -50%) !important;
|
302 |
}
|
303 |
"""
|
304 |
|
@@ -372,7 +378,7 @@ input[type="radio"]:checked::after {
|
|
372 |
# gr.Markdown("## See MetaPrompt Impact")
|
373 |
with gr.Row():
|
374 |
apply_model = gr.Dropdown(models,
|
375 |
-
value="meta-llama/
|
376 |
label="Choose the Model",
|
377 |
container=False, # This removes the container around the dropdown
|
378 |
scale=1, # Controls the width relative to other components
|
|
|
152 |
def __init__(self, prompt_refiner: PromptRefiner):
|
153 |
self.prompt_refiner = prompt_refiner
|
154 |
custom_css = """
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
.container {
|
156 |
border: 2px solid #2196F3;
|
157 |
border-radius: 10px;
|
|
|
159 |
margin: 6px;
|
160 |
background: white;
|
161 |
position: relative;
|
162 |
+
width: 100% !important;
|
163 |
+
max-width: 800px !important;
|
164 |
+
margin: 0 auto 20px auto !important;
|
165 |
}
|
166 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
.container::before {
|
168 |
position: absolute;
|
169 |
top: -10px;
|
|
|
174 |
font-weight: bold;
|
175 |
font-size: 1.2em;
|
176 |
}
|
177 |
+
|
178 |
+
.container::after {
|
179 |
+
content: '' !important;
|
180 |
+
position: absolute !important;
|
181 |
+
top: 0 !important;
|
182 |
+
left: 0 !important;
|
183 |
+
right: 0 !important;
|
184 |
+
bottom: 0 !important;
|
185 |
+
background-image: url('your-image-url.jpg') !important;
|
186 |
+
background-size: cover !important;
|
187 |
+
background-position: center !important;
|
188 |
+
opacity: 0.05 !important;
|
189 |
+
z-index: -1 !important;
|
190 |
+
border-radius: 10px !important;
|
191 |
+
}
|
192 |
+
|
193 |
.title-container {
|
194 |
width: fit-content !important;
|
195 |
margin: 0 auto !important;
|
196 |
+
padding: 2px 40px !important;
|
197 |
border: 1px solid #0066cc !important;
|
198 |
border-radius: 10px !important;
|
199 |
background-color: rgba(0, 102, 204, 0.05) !important;
|
|
|
201 |
|
202 |
.title-container * {
|
203 |
text-align: center;
|
204 |
+
margin: 0 !important;
|
205 |
+
line-height: 1.2 !important;
|
206 |
}
|
207 |
|
|
|
208 |
.title-container h1 {
|
209 |
font-size: 28px !important;
|
210 |
margin-bottom: 1px !important;
|
|
|
219 |
font-size: 14px !important;
|
220 |
margin-bottom: 1px !important;
|
221 |
}
|
222 |
+
|
223 |
+
.input-container::before {
|
224 |
+
content: 'PROMPT REFINEMENT';
|
225 |
+
}
|
226 |
+
|
227 |
+
.analysis-container::before {
|
228 |
+
content: 'ANALYSIS';
|
229 |
+
}
|
230 |
+
|
231 |
+
.model-container::before {
|
232 |
+
content: 'MODEL APPLICATION';
|
233 |
+
}
|
234 |
+
|
235 |
+
.examples-container::before {
|
236 |
+
content: 'EXAMPLES';
|
237 |
+
}
|
238 |
+
|
239 |
+
.container2 {
|
240 |
+
border: 1px solid #CBDCEB !important;
|
241 |
+
border-radius: 8px !important;
|
242 |
+
padding: 8px !important;
|
243 |
+
margin: 6px 0 !important;
|
244 |
+
background: white !important;
|
245 |
+
}
|
246 |
+
|
247 |
+
.input-container textarea {
|
248 |
+
height: 200px !important;
|
249 |
+
}
|
250 |
+
|
251 |
+
.no-background {
|
252 |
+
background: transparent !important;
|
253 |
+
}
|
254 |
+
|
255 |
+
/* Radio group styling */
|
256 |
+
.radio-group {
|
257 |
display: flex !important;
|
258 |
gap: 8px !important;
|
259 |
+
flex-wrap: wrap !important;
|
260 |
+
margin: 10px 0 !important;
|
261 |
}
|
262 |
|
|
|
263 |
.gradio-radio label {
|
|
|
|
|
264 |
padding: 6px 12px !important;
|
265 |
border: 1px solid #ddd !important;
|
266 |
border-radius: 4px !important;
|
|
|
268 |
background: white !important;
|
269 |
}
|
270 |
|
|
|
271 |
.gradio-radio input[type="radio"]:checked + label {
|
272 |
background: #e3f2fd !important;
|
273 |
border-color: #2196F3 !important;
|
274 |
color: #2196F3 !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
275 |
}
|
276 |
|
277 |
+
/* Textbox styling */
|
278 |
+
.gradio-textbox textarea {
|
|
|
|
|
279 |
border: 1px solid #ddd !important;
|
|
|
280 |
border-radius: 4px !important;
|
281 |
+
padding: 8px !important;
|
282 |
+
min-height: 100px !important;
|
283 |
}
|
284 |
|
285 |
+
/* Button styling */
|
286 |
+
.gradio-button {
|
287 |
+
background-color: #2196F3 !important;
|
288 |
+
color: white !important;
|
289 |
+
border-radius: 4px !important;
|
290 |
+
padding: 8px 16px !important;
|
291 |
+
margin: 10px 0 !important;
|
|
|
|
|
|
|
|
|
292 |
}
|
293 |
|
294 |
+
/* Accordion styling */
|
295 |
+
.gradio-accordion {
|
296 |
+
margin: 10px 0 !important;
|
297 |
+
border: none !important;
|
298 |
}
|
299 |
|
300 |
+
/* Fix container alignment */
|
301 |
+
.gradio-container {
|
302 |
+
display: flex !important;
|
303 |
+
flex-direction: column !important;
|
304 |
+
align-items: center !important;
|
305 |
+
width: 100% !important;
|
306 |
+
max-width: 800px !important;
|
307 |
+
margin: 0 auto !important;
|
|
|
|
|
308 |
}
|
309 |
"""
|
310 |
|
|
|
378 |
# gr.Markdown("## See MetaPrompt Impact")
|
379 |
with gr.Row():
|
380 |
apply_model = gr.Dropdown(models,
|
381 |
+
value="meta-llama/Llama-3.1-8B-Instruct",
|
382 |
label="Choose the Model",
|
383 |
container=False, # This removes the container around the dropdown
|
384 |
scale=1, # Controls the width relative to other components
|