Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -102,71 +102,163 @@ class GradioInterface:
|
|
102 |
def __init__(self, prompt_refiner: PromptRefiner):
|
103 |
self.prompt_refiner = prompt_refiner
|
104 |
custom_css = """
|
|
|
105 |
.container {
|
106 |
-
border: 2px solid #
|
107 |
border-radius: 10px;
|
108 |
-
padding:
|
109 |
-
margin:
|
110 |
background: white;
|
111 |
position: relative;
|
112 |
}
|
113 |
|
|
|
114 |
.container::before {
|
115 |
position: absolute;
|
116 |
top: -10px;
|
117 |
-
left:
|
118 |
background: white;
|
119 |
padding: 0 10px;
|
120 |
-
color: #
|
121 |
font-weight: bold;
|
122 |
font-size: 1.2em;
|
123 |
}
|
124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
.no-background > div:first-child {
|
126 |
border: none !important;
|
127 |
background: transparent !important;
|
128 |
box-shadow: none !important;
|
129 |
}
|
130 |
|
131 |
-
|
132 |
-
|
|
|
|
|
133 |
}
|
134 |
|
135 |
-
|
136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
}
|
138 |
|
139 |
-
|
|
|
140 |
.input-container::before { content: 'PROMPT REFINEMENT'; }
|
141 |
.analysis-container::before { content: 'ANALYSIS & REFINEMENT'; }
|
142 |
.model-container::before { content: 'MODEL APPLICATION'; }
|
143 |
.results-container::before { content: 'RESULTS'; }
|
144 |
.examples-container::before { content: 'EXAMPLES'; }
|
145 |
|
|
|
146 |
.radio-group {
|
147 |
display: flex;
|
148 |
-
gap:
|
149 |
-
margin:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
}
|
151 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
.gr-form > div {
|
153 |
gap: 0.5rem !important;
|
154 |
}
|
155 |
|
|
|
156 |
.gr-textbox {
|
157 |
padding: 0.3rem !important;
|
158 |
-
border: 2px solid #4CAF50 !important;
|
159 |
-
border-radius: 5px !important;
|
160 |
}
|
161 |
|
162 |
-
|
163 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
}
|
165 |
-
|
166 |
|
167 |
with gr.Blocks(css=custom_css, theme=gr.themes.Default()) as self.interface:
|
168 |
with gr.Column(elem_classes=["container", "title-container"]):
|
169 |
-
|
170 |
gr.Markdown("### Automating Prompt Engineering by Refining your Prompts")
|
171 |
gr.Markdown("Learn how to generate an improved version of your prompts.")
|
172 |
|
@@ -200,7 +292,7 @@ class GradioInterface:
|
|
200 |
full_response_json = gr.JSON()
|
201 |
|
202 |
with gr.Column(elem_classes=["container", "model-container"]):
|
203 |
-
|
204 |
with gr.Row():
|
205 |
apply_model = gr.Dropdown(
|
206 |
[
|
|
|
102 |
def __init__(self, prompt_refiner: PromptRefiner):
|
103 |
self.prompt_refiner = prompt_refiner
|
104 |
custom_css = """
|
105 |
+
/* Main containers */
|
106 |
.container {
|
107 |
+
border: 2px solid #4CAF50; /* Green border for main containers */
|
108 |
border-radius: 10px;
|
109 |
+
padding: 12px;
|
110 |
+
margin: 8px;
|
111 |
background: white;
|
112 |
position: relative;
|
113 |
}
|
114 |
|
115 |
+
/* Container labels */
|
116 |
.container::before {
|
117 |
position: absolute;
|
118 |
top: -10px;
|
119 |
+
left: 20px;
|
120 |
background: white;
|
121 |
padding: 0 10px;
|
122 |
+
color: #4CAF50; /* Green text for labels */
|
123 |
font-weight: bold;
|
124 |
font-size: 1.2em;
|
125 |
}
|
126 |
|
127 |
+
/* Remove all default Gradio container styles */
|
128 |
+
.gradio-container {
|
129 |
+
border: none !important;
|
130 |
+
background: none !important;
|
131 |
+
}
|
132 |
+
|
133 |
+
/* Input elements styling */
|
134 |
+
.gradio-container input,
|
135 |
+
.gradio-container textarea,
|
136 |
+
.gradio-container select {
|
137 |
+
border: none !important;
|
138 |
+
background: white !important;
|
139 |
+
box-shadow: none !important;
|
140 |
+
}
|
141 |
+
|
142 |
+
/* Remove backgrounds and borders */
|
143 |
.no-background > div:first-child {
|
144 |
border: none !important;
|
145 |
background: transparent !important;
|
146 |
box-shadow: none !important;
|
147 |
}
|
148 |
|
149 |
+
/* Remove focus outlines */
|
150 |
+
*:focus {
|
151 |
+
outline: none !important;
|
152 |
+
box-shadow: none !important;
|
153 |
}
|
154 |
|
155 |
+
/* Title styling */
|
156 |
+
h1 {
|
157 |
+
color: #4CAF50 !important;
|
158 |
+
font-size: 2.5em !important;
|
159 |
+
font-weight: bold !important;
|
160 |
+
margin-bottom: 0.5em !important;
|
161 |
+
text-align: center !important;
|
162 |
+
}
|
163 |
+
|
164 |
+
h3 {
|
165 |
+
color: #666 !important;
|
166 |
+
font-size: 1.2em !important;
|
167 |
+
text-align: center !important;
|
168 |
+
margin-bottom: 1em !important;
|
169 |
}
|
170 |
|
171 |
+
/* Container labels */
|
172 |
+
.title-container::before { content: ''; }
|
173 |
.input-container::before { content: 'PROMPT REFINEMENT'; }
|
174 |
.analysis-container::before { content: 'ANALYSIS & REFINEMENT'; }
|
175 |
.model-container::before { content: 'MODEL APPLICATION'; }
|
176 |
.results-container::before { content: 'RESULTS'; }
|
177 |
.examples-container::before { content: 'EXAMPLES'; }
|
178 |
|
179 |
+
/* Radio button group */
|
180 |
.radio-group {
|
181 |
display: flex;
|
182 |
+
gap: 8px;
|
183 |
+
margin: 8px 0;
|
184 |
+
}
|
185 |
+
|
186 |
+
/* Remove nested container borders */
|
187 |
+
.container .gradio-container,
|
188 |
+
.container .gradio-container > div {
|
189 |
+
border: none !important;
|
190 |
+
box-shadow: none !important;
|
191 |
+
}
|
192 |
+
|
193 |
+
/* Target specific Gradio elements */
|
194 |
+
.gr-box,
|
195 |
+
.gr-form,
|
196 |
+
.gr-input,
|
197 |
+
.gr-panel {
|
198 |
+
border: none !important;
|
199 |
+
box-shadow: none !important;
|
200 |
}
|
201 |
|
202 |
+
/* Markdown text styling */
|
203 |
+
.markdown {
|
204 |
+
font-size: 1em !important;
|
205 |
+
line-height: 1.6 !important;
|
206 |
+
color: #333 !important;
|
207 |
+
margin: 0.3em 0 !important;
|
208 |
+
}
|
209 |
+
|
210 |
+
/* Button styling */
|
211 |
+
button {
|
212 |
+
background: #4CAF50 !important;
|
213 |
+
color: white !important;
|
214 |
+
border: none !important;
|
215 |
+
border-radius: 5px !important;
|
216 |
+
padding: 8px 16px !important;
|
217 |
+
cursor: pointer !important;
|
218 |
+
transition: background 0.3s !important;
|
219 |
+
}
|
220 |
+
|
221 |
+
button:hover {
|
222 |
+
background: #45a049 !important;
|
223 |
+
}
|
224 |
+
|
225 |
+
/* Accordion styling */
|
226 |
+
.gr-accordion {
|
227 |
+
margin: 0.3rem 0 !important;
|
228 |
+
border: none !important;
|
229 |
+
}
|
230 |
+
|
231 |
+
/* Reduce spacing in forms */
|
232 |
.gr-form > div {
|
233 |
gap: 0.5rem !important;
|
234 |
}
|
235 |
|
236 |
+
/* Textbox padding */
|
237 |
.gr-textbox {
|
238 |
padding: 0.3rem !important;
|
|
|
|
|
239 |
}
|
240 |
|
241 |
+
/* Remove any remaining borders */
|
242 |
+
.container * {
|
243 |
+
border-color: transparent !important;
|
244 |
+
}
|
245 |
+
|
246 |
+
/* Tabs styling */
|
247 |
+
.tabs {
|
248 |
+
border: none !important;
|
249 |
+
margin-top: 0.5rem !important;
|
250 |
+
}
|
251 |
+
|
252 |
+
/* Dropdown styling */
|
253 |
+
.gr-dropdown {
|
254 |
+
border: none !important;
|
255 |
+
background: white !important;
|
256 |
}
|
257 |
+
"""
|
258 |
|
259 |
with gr.Blocks(css=custom_css, theme=gr.themes.Default()) as self.interface:
|
260 |
with gr.Column(elem_classes=["container", "title-container"]):
|
261 |
+
gr.Markdown("# PROMPT++")
|
262 |
gr.Markdown("### Automating Prompt Engineering by Refining your Prompts")
|
263 |
gr.Markdown("Learn how to generate an improved version of your prompts.")
|
264 |
|
|
|
292 |
full_response_json = gr.JSON()
|
293 |
|
294 |
with gr.Column(elem_classes=["container", "model-container"]):
|
295 |
+
# gr.Markdown("## See MetaPrompt Impact")
|
296 |
with gr.Row():
|
297 |
apply_model = gr.Dropdown(
|
298 |
[
|