Commit ·
eb7f0d2
1
Parent(s): 43afb5a
moved clear all
Browse files
app.py
CHANGED
|
@@ -29,6 +29,16 @@ except Exception as e:
|
|
| 29 |
with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) as demo:
|
| 30 |
gr.Markdown("## DeepV for RTL Code Generation — Model-Agnostic (Bring Your Own API Key)")
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
with gr.Row():
|
| 33 |
with gr.Column(scale=2):
|
| 34 |
with gr.Row():
|
|
@@ -68,6 +78,13 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
|
|
| 68 |
visible=False,
|
| 69 |
elem_id="loading-state"
|
| 70 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
|
| 72 |
with gr.Column(scale=3):
|
| 73 |
gr.Markdown("**Output**")
|
|
@@ -90,12 +107,6 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
|
|
| 90 |
with gr.Tab("Preview of Retrieved Context (raw)"):
|
| 91 |
retrieved_raw = gr.HighlightedText(label="(first K documents)", combine_adjacent=True)
|
| 92 |
|
| 93 |
-
with gr.Row():
|
| 94 |
-
clear_btn = gr.ClearButton(
|
| 95 |
-
value="Clear All",
|
| 96 |
-
components=[spec, api_key, out_code, retrieved_list, retrieved_raw]
|
| 97 |
-
)
|
| 98 |
-
|
| 99 |
def copy_to_clipboard_fn(text):
|
| 100 |
return text
|
| 101 |
|
|
@@ -120,6 +131,9 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
|
|
| 120 |
outputs=[run_btn, loading_state]
|
| 121 |
)
|
| 122 |
|
|
|
|
|
|
|
|
|
|
| 123 |
copy_button.click(
|
| 124 |
fn=copy_to_clipboard_fn,
|
| 125 |
inputs=[out_code],
|
|
@@ -153,14 +167,11 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
|
|
| 153 |
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
| 154 |
}
|
| 155 |
|
| 156 |
-
/* Styling for the loading state markdown block */
|
| 157 |
#loading-state {
|
| 158 |
padding: 14px;
|
| 159 |
text-align: center;
|
| 160 |
font-size: 1.2em;
|
| 161 |
-
/* Made font bolder */
|
| 162 |
font-weight: 800;
|
| 163 |
-
/* Changed color to match the blue in the soft theme */
|
| 164 |
color: #1E3A8A;
|
| 165 |
background-color: #e6f2ff;
|
| 166 |
border-radius: 8px;
|
|
@@ -168,7 +179,6 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
|
|
| 168 |
animation: pulse 1s infinite;
|
| 169 |
}
|
| 170 |
|
| 171 |
-
/* CSS keyframes for the pulsing animation */
|
| 172 |
@keyframes pulse {
|
| 173 |
0% { background-color: #e6f2ff; }
|
| 174 |
50% { background-color: #d2e4f7; }
|
|
|
|
| 29 |
with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) as demo:
|
| 30 |
gr.Markdown("## DeepV for RTL Code Generation — Model-Agnostic (Bring Your Own API Key)")
|
| 31 |
|
| 32 |
+
# Status Bar for success/error messages
|
| 33 |
+
status_bar = gr.Textbox(
|
| 34 |
+
label="Status",
|
| 35 |
+
lines=1,
|
| 36 |
+
interactive=False,
|
| 37 |
+
show_copy_button=False,
|
| 38 |
+
container=False,
|
| 39 |
+
value="Ready"
|
| 40 |
+
)
|
| 41 |
+
|
| 42 |
with gr.Row():
|
| 43 |
with gr.Column(scale=2):
|
| 44 |
with gr.Row():
|
|
|
|
| 78 |
visible=False,
|
| 79 |
elem_id="loading-state"
|
| 80 |
)
|
| 81 |
+
|
| 82 |
+
# Moved the clear button here
|
| 83 |
+
with gr.Row():
|
| 84 |
+
clear_btn = gr.ClearButton(
|
| 85 |
+
value="Clear All",
|
| 86 |
+
components=[spec, api_key, out_code, retrieved_list, retrieved_raw]
|
| 87 |
+
)
|
| 88 |
|
| 89 |
with gr.Column(scale=3):
|
| 90 |
gr.Markdown("**Output**")
|
|
|
|
| 107 |
with gr.Tab("Preview of Retrieved Context (raw)"):
|
| 108 |
retrieved_raw = gr.HighlightedText(label="(first K documents)", combine_adjacent=True)
|
| 109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
def copy_to_clipboard_fn(text):
|
| 111 |
return text
|
| 112 |
|
|
|
|
| 131 |
outputs=[run_btn, loading_state]
|
| 132 |
)
|
| 133 |
|
| 134 |
+
clear_btn.click(fn=lambda: "Ready", outputs=[status_bar])
|
| 135 |
+
spec.submit(fn=lambda: "Ready", outputs=[status_bar])
|
| 136 |
+
|
| 137 |
copy_button.click(
|
| 138 |
fn=copy_to_clipboard_fn,
|
| 139 |
inputs=[out_code],
|
|
|
|
| 167 |
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
| 168 |
}
|
| 169 |
|
|
|
|
| 170 |
#loading-state {
|
| 171 |
padding: 14px;
|
| 172 |
text-align: center;
|
| 173 |
font-size: 1.2em;
|
|
|
|
| 174 |
font-weight: 800;
|
|
|
|
| 175 |
color: #1E3A8A;
|
| 176 |
background-color: #e6f2ff;
|
| 177 |
border-radius: 8px;
|
|
|
|
| 179 |
animation: pulse 1s infinite;
|
| 180 |
}
|
| 181 |
|
|
|
|
| 182 |
@keyframes pulse {
|
| 183 |
0% { background-color: #e6f2ff; }
|
| 184 |
50% { background-color: #d2e4f7; }
|