Commit ·
76f4a65
1
Parent(s): e8771b6
fixing
Browse files
app.py
CHANGED
|
@@ -72,7 +72,6 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
|
|
| 72 |
top_p = gr.Slider(0.1, 1.0, value=0.9, step=0.05, label="Top-p")
|
| 73 |
max_new_tokens = gr.Slider(128, 4096, value=768, step=64, label="Max tokens")
|
| 74 |
|
| 75 |
-
# Moved the buttons to be after all the inputs
|
| 76 |
with gr.Row():
|
| 77 |
run_btn = gr.Button("Generate Verilog", variant="primary")
|
| 78 |
|
|
@@ -97,14 +96,12 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
|
|
| 97 |
with gr.Tab("Preview of Retrieved Context (raw)"):
|
| 98 |
retrieved_raw = gr.HighlightedText(label="(first K documents)", combine_adjacent=True)
|
| 99 |
|
| 100 |
-
# Now that all components are defined, we can add the clear button here
|
| 101 |
with gr.Row():
|
| 102 |
clear_btn = gr.ClearButton(
|
| 103 |
value="Clear All",
|
| 104 |
components=[spec, api_key, out_code, retrieved_list, retrieved_raw]
|
| 105 |
)
|
| 106 |
|
| 107 |
-
# --- Back-end copy function ---
|
| 108 |
def copy_to_clipboard_fn(text):
|
| 109 |
return text
|
| 110 |
|
|
@@ -118,9 +115,7 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
|
|
| 118 |
outputs=[status_bar]
|
| 119 |
)
|
| 120 |
|
| 121 |
-
# Update the status bar on other events
|
| 122 |
clear_btn.click(fn=lambda: "Ready", outputs=[status_bar])
|
| 123 |
-
# THIS IS THE KEY CHANGE. Use a submit event instead of a change event.
|
| 124 |
spec.submit(fn=lambda: "Ready", outputs=[status_bar])
|
| 125 |
|
| 126 |
copy_button.click(
|
|
@@ -140,14 +135,25 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
|
|
| 140 |
)
|
| 141 |
|
| 142 |
demo.css = """
|
|
|
|
| 143 |
#verilog-output > label > .label-wrap {
|
| 144 |
position: relative;
|
|
|
|
| 145 |
}
|
|
|
|
| 146 |
#copy-button {
|
| 147 |
position: absolute;
|
| 148 |
top: 20px;
|
| 149 |
right: 10px;
|
| 150 |
-
z-index
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
}
|
| 152 |
"""
|
| 153 |
|
|
|
|
| 72 |
top_p = gr.Slider(0.1, 1.0, value=0.9, step=0.05, label="Top-p")
|
| 73 |
max_new_tokens = gr.Slider(128, 4096, value=768, step=64, label="Max tokens")
|
| 74 |
|
|
|
|
| 75 |
with gr.Row():
|
| 76 |
run_btn = gr.Button("Generate Verilog", variant="primary")
|
| 77 |
|
|
|
|
| 96 |
with gr.Tab("Preview of Retrieved Context (raw)"):
|
| 97 |
retrieved_raw = gr.HighlightedText(label="(first K documents)", combine_adjacent=True)
|
| 98 |
|
|
|
|
| 99 |
with gr.Row():
|
| 100 |
clear_btn = gr.ClearButton(
|
| 101 |
value="Clear All",
|
| 102 |
components=[spec, api_key, out_code, retrieved_list, retrieved_raw]
|
| 103 |
)
|
| 104 |
|
|
|
|
| 105 |
def copy_to_clipboard_fn(text):
|
| 106 |
return text
|
| 107 |
|
|
|
|
| 115 |
outputs=[status_bar]
|
| 116 |
)
|
| 117 |
|
|
|
|
| 118 |
clear_btn.click(fn=lambda: "Ready", outputs=[status_bar])
|
|
|
|
| 119 |
spec.submit(fn=lambda: "Ready", outputs=[status_bar])
|
| 120 |
|
| 121 |
copy_button.click(
|
|
|
|
| 135 |
)
|
| 136 |
|
| 137 |
demo.css = """
|
| 138 |
+
/* Ensure the label wrapping the textbox has relative positioning for z-index context */
|
| 139 |
#verilog-output > label > .label-wrap {
|
| 140 |
position: relative;
|
| 141 |
+
z-index: 1; /* Give it a stacking context */
|
| 142 |
}
|
| 143 |
+
|
| 144 |
#copy-button {
|
| 145 |
position: absolute;
|
| 146 |
top: 20px;
|
| 147 |
right: 10px;
|
| 148 |
+
/* Significantly increase z-index to guarantee it's on top */
|
| 149 |
+
z-index: 1000;
|
| 150 |
+
|
| 151 |
+
/* Clean, modern, non-green colors */
|
| 152 |
+
background-color: #333; /* A dark gray */
|
| 153 |
+
color: #eee; /* Light gray text */
|
| 154 |
+
border-radius: 5px; /* Slightly rounded corners */
|
| 155 |
+
border: none; /* Remove border */
|
| 156 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Subtle shadow for depth */
|
| 157 |
}
|
| 158 |
"""
|
| 159 |
|