Commit ·
f86d510
1
Parent(s): c9c5035
fixing 4
Browse files
app.py
CHANGED
|
@@ -72,13 +72,13 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
|
|
| 72 |
|
| 73 |
# --- Loading State Components ---
|
| 74 |
with gr.Row():
|
| 75 |
-
run_btn = gr.Button("Generate Verilog", variant="primary")
|
| 76 |
-
# New loading state components
|
| 77 |
loading_state = gr.Textbox(
|
| 78 |
value="Generating...",
|
| 79 |
show_copy_button=False,
|
| 80 |
visible=False,
|
| 81 |
-
container=
|
|
|
|
| 82 |
)
|
| 83 |
|
| 84 |
with gr.Column(scale=3):
|
|
@@ -111,20 +111,17 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
|
|
| 111 |
def copy_to_clipboard_fn(text):
|
| 112 |
return text
|
| 113 |
|
| 114 |
-
# Helper function to show loading state
|
| 115 |
def show_loading():
|
| 116 |
return [gr.update(visible=False), gr.update(visible=True)]
|
| 117 |
|
| 118 |
-
# Helper function to hide loading state
|
| 119 |
def hide_loading():
|
| 120 |
return [gr.update(visible=True), gr.update(visible=False)]
|
| 121 |
|
| 122 |
-
# --- Event Handlers ---
|
| 123 |
run_btn.click(
|
| 124 |
fn=show_loading,
|
| 125 |
inputs=[],
|
| 126 |
outputs=[run_btn, loading_state],
|
| 127 |
-
show_progress=False
|
| 128 |
).then(
|
| 129 |
fn=run_generation,
|
| 130 |
inputs=[spec, use_rag, top_k, model_choice, api_key, temperature, top_p, max_new_tokens],
|
|
@@ -135,7 +132,6 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
|
|
| 135 |
outputs=[run_btn, loading_state]
|
| 136 |
)
|
| 137 |
|
| 138 |
-
# Status bar updates
|
| 139 |
clear_btn.click(fn=lambda: "Ready", outputs=[status_bar])
|
| 140 |
spec.submit(fn=lambda: "Ready", outputs=[status_bar])
|
| 141 |
|
|
@@ -171,6 +167,23 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
|
|
| 171 |
border: none;
|
| 172 |
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
| 173 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 174 |
"""
|
| 175 |
|
| 176 |
if __name__ == "__main__":
|
|
|
|
| 72 |
|
| 73 |
# --- Loading State Components ---
|
| 74 |
with gr.Row():
|
| 75 |
+
run_btn = gr.Button("Generate Verilog", variant="primary", elem_id="generate-button")
|
|
|
|
| 76 |
loading_state = gr.Textbox(
|
| 77 |
value="Generating...",
|
| 78 |
show_copy_button=False,
|
| 79 |
visible=False,
|
| 80 |
+
container=True,
|
| 81 |
+
elem_id="loading-state"
|
| 82 |
)
|
| 83 |
|
| 84 |
with gr.Column(scale=3):
|
|
|
|
| 111 |
def copy_to_clipboard_fn(text):
|
| 112 |
return text
|
| 113 |
|
|
|
|
| 114 |
def show_loading():
|
| 115 |
return [gr.update(visible=False), gr.update(visible=True)]
|
| 116 |
|
|
|
|
| 117 |
def hide_loading():
|
| 118 |
return [gr.update(visible=True), gr.update(visible=False)]
|
| 119 |
|
|
|
|
| 120 |
run_btn.click(
|
| 121 |
fn=show_loading,
|
| 122 |
inputs=[],
|
| 123 |
outputs=[run_btn, loading_state],
|
| 124 |
+
show_progress=False
|
| 125 |
).then(
|
| 126 |
fn=run_generation,
|
| 127 |
inputs=[spec, use_rag, top_k, model_choice, api_key, temperature, top_p, max_new_tokens],
|
|
|
|
| 132 |
outputs=[run_btn, loading_state]
|
| 133 |
)
|
| 134 |
|
|
|
|
| 135 |
clear_btn.click(fn=lambda: "Ready", outputs=[status_bar])
|
| 136 |
spec.submit(fn=lambda: "Ready", outputs=[status_bar])
|
| 137 |
|
|
|
|
| 167 |
border: none;
|
| 168 |
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
| 169 |
}
|
| 170 |
+
|
| 171 |
+
/* Styling for the loading state textbox */
|
| 172 |
+
#loading-state {
|
| 173 |
+
text-align: center;
|
| 174 |
+
font-size: 1.2em;
|
| 175 |
+
font-weight: bold;
|
| 176 |
+
color: #2e8b57; /* A nice dark blue from the soft theme palette */
|
| 177 |
+
background-color: #e6f2ff; /* A light blue that matches the soft theme */
|
| 178 |
+
animation: pulse 1s infinite;
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
/* CSS keyframes for the pulsing animation */
|
| 182 |
+
@keyframes pulse {
|
| 183 |
+
0% { background-color: #e6f2ff; }
|
| 184 |
+
50% { background-color: #d2e4f7; }
|
| 185 |
+
100% { background-color: #e6f2ff; }
|
| 186 |
+
}
|
| 187 |
"""
|
| 188 |
|
| 189 |
if __name__ == "__main__":
|