baconnier commited on
Commit
69ba8e8
1 Parent(s): 965663c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -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
  class PromptInput(BaseModel):
11
  text: str = Field(..., description="The initial prompt text")
12
  meta_prompt_choice: Literal["star","done","physics","morphosis", "verse", "phor","bolism","math","arpe"] = Field(..., description="Choice of meta prompt strategy")
@@ -153,180 +155,7 @@ class PromptRefiner:
153
  class GradioInterface:
154
  def __init__(self, prompt_refiner: PromptRefiner):
155
  self.prompt_refiner = prompt_refiner
156
- custom_css = """
157
- .container {
158
- border: 2px solid #2196F3;
159
- border-radius: 10px;
160
- padding: 12px;
161
- margin: 6px;
162
- background: white;
163
- position: relative;
164
- width: 100% !important;
165
- max-width: 1200px !important;
166
- margin: 0 auto 20px auto !important;
167
- }
168
-
169
- .container::before {
170
- position: absolute;
171
- top: -10px;
172
- left: 20px;
173
- background: white;
174
- padding: 0 10px;
175
- color: #2196F3;
176
- font-weight: bold;
177
- font-size: 1.2em;
178
- }
179
-
180
- .title-container {
181
- width: fit-content !important;
182
- margin: 0 auto !important;
183
- padding: 2px 40px !important;
184
- border: 1px solid #0066cc !important;
185
- border-radius: 10px !important;
186
- background-color: rgba(0, 102, 204, 0.05) !important;
187
- }
188
-
189
- .title-container * {
190
- text-align: center;
191
- margin: 0 !important;
192
- line-height: 1.2 !important;
193
- }
194
-
195
- .title-container h1 {
196
- font-size: 28px !important;
197
- margin-bottom: 1px !important;
198
- }
199
-
200
- .title-container h3 {
201
- font-size: 18px !important;
202
- margin-bottom: 1px !important;
203
- }
204
-
205
- .title-container p {
206
- font-size: 14px !important;
207
- margin-bottom: 1px !important;
208
- }
209
-
210
- .input-container::before {
211
- content: 'PROMPT REFINEMENT';
212
- }
213
-
214
- .analysis-container::before {
215
- content: 'ANALYSIS';
216
- }
217
-
218
- .model-container::before {
219
- content: 'MODEL APPLICATION';
220
- }
221
-
222
- .examples-container::before {
223
- content: 'EXAMPLES';
224
- }
225
-
226
- /* Resizable textbox */
227
- .input-container textarea {
228
- resize: vertical !important;
229
- min-height: 100px !important;
230
- max-height: 500px !important;
231
- width: 100% !important;
232
- border: 1px solid #ddd !important;
233
- border-radius: 4px !important;
234
- padding: 8px !important;
235
- transition: all 0.3s ease !important;
236
- }
237
-
238
- .input-container textarea:focus {
239
- border-color: #2196F3 !important;
240
- box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1) !important;
241
- }
242
-
243
- /* Radio group styling */
244
- .radio-group {
245
- background-color: rgba(0, 102, 204, 0.05) !important;
246
- padding: 10px !important;
247
- border-radius: 8px !important;
248
- border: 1px solid rgba(0, 102, 204, 0.1) !important;
249
- display: flex !important;
250
- justify-content: center !important;
251
- flex-wrap: wrap !important;
252
- gap: 8px !important;
253
- width: 100% !important;
254
- }
255
-
256
- .gradio-radio {
257
- display: flex !important;
258
- justify-content: center !important;
259
- flex-wrap: wrap !important;
260
- gap: 8px !important;
261
- }
262
-
263
- .gradio-radio label {
264
- display: flex !important;
265
- align-items: center !important;
266
- padding: 6px 12px !important;
267
- border: 1px solid #ddd !important;
268
- border-radius: 4px !important;
269
- cursor: pointer !important;
270
- background: white !important;
271
- margin: 4px !important;
272
- }
273
-
274
- .gradio-radio input[type="radio"]:checked + label {
275
- background: rgba(0, 102, 204, 0.1) !important;
276
- border-color: #0066cc !important;
277
- color: #0066cc !important;
278
- font-weight: bold !important;
279
- }
280
-
281
- /* Button styling */
282
- .gradio-button {
283
- background-color: white !important;
284
- color: #2196F3 !important;
285
- border: 2px solid #2196F3 !important;
286
- border-radius: 4px !important;
287
- padding: 8px 16px !important;
288
- margin: 10px 0 !important;
289
- font-weight: bold !important;
290
- transition: all 0.3s ease !important;
291
- }
292
-
293
- .gradio-button:hover {
294
- background-color: #2196F3 !important;
295
- color: white !important;
296
- box-shadow: 0 2px 5px rgba(33, 150, 243, 0.3) !important;
297
- }
298
-
299
- /* Accordion styling */
300
- .gradio-accordion {
301
- margin: 10px 0 !important;
302
- border: none !important;
303
- }
304
-
305
- /* Container alignment */
306
- .gradio-container {
307
- display: flex !important;
308
- flex-direction: column !important;
309
- align-items: center !important;
310
- width: 100% !important;
311
- max-width: 1200px !important;
312
- margin: 0 auto !important;
313
- }
314
-
315
- /* Dropdown styling */
316
- .gradio-dropdown {
317
- width: 100% !important;
318
- max-width: 300px !important;
319
- }
320
-
321
- /* JSON container */
322
- .full-response-json {
323
- margin-top: 20px !important;
324
- padding: 10px !important;
325
- background-color: rgba(0, 102, 204, 0.05) !important;
326
- border-radius: 8px !important;
327
- }
328
- """
329
-
330
  with gr.Blocks(css=custom_css, theme=gr.themes.Default()) as self.interface:
331
  with gr.Column(elem_classes=["container", "title-container"]):
332
  gr.Markdown("# PROMPT++")
 
7
  from typing import Optional, Literal
8
  from huggingface_hub.errors import HfHubHTTPError
9
 
10
+ from custom_css import all
11
+
12
  class PromptInput(BaseModel):
13
  text: str = Field(..., description="The initial prompt text")
14
  meta_prompt_choice: Literal["star","done","physics","morphosis", "verse", "phor","bolism","math","arpe"] = Field(..., description="Choice of meta prompt strategy")
 
155
  class GradioInterface:
156
  def __init__(self, prompt_refiner: PromptRefiner):
157
  self.prompt_refiner = prompt_refiner
158
+ custom_css = custom_css
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
  with gr.Blocks(css=custom_css, theme=gr.themes.Default()) as self.interface:
160
  with gr.Column(elem_classes=["container", "title-container"]):
161
  gr.Markdown("# PROMPT++")