baconnier commited on
Commit
569890c
1 Parent(s): 8100125

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -174
app.py CHANGED
@@ -7,6 +7,8 @@ from pydantic import BaseModel, Field
7
  from typing import Optional, Literal
8
  from huggingface_hub.errors import HfHubHTTPError
9
 
 
 
10
 
11
  class PromptInput(BaseModel):
12
  text: str = Field(..., description="The initial prompt text")
@@ -278,180 +280,6 @@ class GradioInterface:
278
  self.interface.launch(share=share)
279
 
280
 
281
- custom_css = """
282
- .container {
283
- border: 2px solid #2196F3;
284
- border-radius: 10px;
285
- padding: 12px;
286
- margin: 6px;
287
- background: white;
288
- position: relative;
289
- width: 100% !important;
290
- max-width: 1200px !important;
291
- margin: 0 auto 20px auto !important;
292
- }
293
-
294
- .container::before {
295
- position: absolute;
296
- top: -10px;
297
- left: 20px;
298
- background: white;
299
- padding: 0 10px;
300
- color: #2196F3;
301
- font-weight: bold;
302
- font-size: 1.2em;
303
- }
304
-
305
- .title-container {
306
- width: fit-content !important;
307
- margin: 0 auto !important;
308
- padding: 2px 40px !important;
309
- border: 1px solid #0066cc !important;
310
- border-radius: 10px !important;
311
- background-color: rgba(0, 102, 204, 0.05) !important;
312
- }
313
-
314
- .title-container * {
315
- text-align: center;
316
- margin: 0 !important;
317
- line-height: 1.2 !important;
318
- }
319
-
320
- .title-container h1 {
321
- font-size: 28px !important;
322
- margin-bottom: 1px !important;
323
- }
324
-
325
- .title-container h3 {
326
- font-size: 18px !important;
327
- margin-bottom: 1px !important;
328
- }
329
-
330
- .title-container p {
331
- font-size: 14px !important;
332
- margin-bottom: 1px !important;
333
- }
334
-
335
- .input-container::before {
336
- content: 'PROMPT REFINEMENT';
337
- }
338
-
339
- .analysis-container::before {
340
- content: 'ANALYSIS';
341
- }
342
-
343
- .model-container::before {
344
- content: 'MODEL APPLICATION';
345
- }
346
-
347
- .examples-container::before {
348
- content: 'EXAMPLES';
349
- }
350
-
351
- /* Resizable textbox */
352
- .input-container textarea {
353
- resize: vertical !important;
354
- min-height: 100px !important;
355
- max-height: 500px !important;
356
- width: 100% !important;
357
- border: 1px solid #ddd !important;
358
- border-radius: 4px !important;
359
- padding: 8px !important;
360
- transition: all 0.3s ease !important;
361
- }
362
-
363
- .input-container textarea:focus {
364
- border-color: #2196F3 !important;
365
- box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1) !important;
366
- }
367
-
368
- /* Radio group styling */
369
- .radio-group {
370
- background-color: rgba(0, 102, 204, 0.05) !important;
371
- padding: 10px !important;
372
- border-radius: 8px !important;
373
- border: 1px solid rgba(0, 102, 204, 0.1) !important;
374
- display: flex !important;
375
- justify-content: center !important;
376
- flex-wrap: wrap !important;
377
- gap: 8px !important;
378
- width: 100% !important;
379
- }
380
-
381
- .gradio-radio {
382
- display: flex !important;
383
- justify-content: center !important;
384
- flex-wrap: wrap !important;
385
- gap: 8px !important;
386
- }
387
-
388
- .gradio-radio label {
389
- display: flex !important;
390
- align-items: center !important;
391
- padding: 6px 12px !important;
392
- border: 1px solid #ddd !important;
393
- border-radius: 4px !important;
394
- cursor: pointer !important;
395
- background: white !important;
396
- margin: 4px !important;
397
- }
398
-
399
- .gradio-radio input[type="radio"]:checked + label {
400
- background: rgba(0, 102, 204, 0.1) !important;
401
- border-color: #0066cc !important;
402
- color: #0066cc !important;
403
- font-weight: bold !important;
404
- }
405
-
406
- /* Button styling */
407
- .gradio-button {
408
- background-color: white !important;
409
- color: #2196F3 !important;
410
- border: 2px solid #2196F3 !important;
411
- border-radius: 4px !important;
412
- padding: 8px 16px !important;
413
- margin: 10px 0 !important;
414
- font-weight: bold !important;
415
- transition: all 0.3s ease !important;
416
- }
417
-
418
- .gradio-button:hover {
419
- background-color: #2196F3 !important;
420
- color: white !important;
421
- box-shadow: 0 2px 5px rgba(33, 150, 243, 0.3) !important;
422
- }
423
-
424
- /* Accordion styling */
425
- .gradio-accordion {
426
- margin: 10px 0 !important;
427
- border: none !important;
428
- }
429
-
430
- /* Container alignment */
431
- .gradio-container {
432
- display: flex !important;
433
- flex-direction: column !important;
434
- align-items: center !important;
435
- width: 100% !important;
436
- max-width: 1200px !important;
437
- margin: 0 auto !important;
438
- }
439
-
440
- /* Dropdown styling */
441
- .gradio-dropdown {
442
- width: 100% !important;
443
- max-width: 300px !important;
444
- }
445
-
446
- /* JSON container */
447
- .full-response-json {
448
- margin-top: 20px !important;
449
- padding: 10px !important;
450
- background-color: rgba(0, 102, 204, 0.05) !important;
451
- border-radius: 8px !important;
452
- }
453
- """
454
-
455
  metaprompt_explanations = {
456
  "star": "Use ECHO when you need a comprehensive, multi-stage approach for complex prompts. It's ideal for tasks requiring in-depth analysis, exploration of multiple alternatives, and synthesis of ideas. Choose this over others when you have time for a thorough refinement process and need to consider various aspects of the prompt.",
457
  "done": "Opt for this when you want a structured approach with emphasis on role-playing and advanced techniques. It's particularly useful for tasks that benefit from diverse perspectives and complex reasoning. Prefer this over 'physics' when you need a more detailed, step-by-step refinement process.",
 
7
  from typing import Optional, Literal
8
  from huggingface_hub.errors import HfHubHTTPError
9
 
10
+ from custom_css import custom_css
11
+
12
 
13
  class PromptInput(BaseModel):
14
  text: str = Field(..., description="The initial prompt text")
 
280
  self.interface.launch(share=share)
281
 
282
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
283
  metaprompt_explanations = {
284
  "star": "Use ECHO when you need a comprehensive, multi-stage approach for complex prompts. It's ideal for tasks requiring in-depth analysis, exploration of multiple alternatives, and synthesis of ideas. Choose this over others when you have time for a thorough refinement process and need to consider various aspects of the prompt.",
285
  "done": "Opt for this when you want a structured approach with emphasis on role-playing and advanced techniques. It's particularly useful for tasks that benefit from diverse perspectives and complex reasoning. Prefer this over 'physics' when you need a more detailed, step-by-step refinement process.",