Update app.py
Browse files
app.py
CHANGED
|
@@ -71,10 +71,14 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
|
|
| 71 |
)
|
| 72 |
|
| 73 |
with gr.Column(scale=3):
|
| 74 |
-
# The logo
|
| 75 |
-
gr.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
-
# The output textbox
|
| 78 |
out_code = gr.Textbox(
|
| 79 |
label="Generated Verilog",
|
| 80 |
lines=28,
|
|
@@ -82,8 +86,9 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
|
|
| 82 |
placeholder="// Your Verilog code will appear here",
|
| 83 |
elem_id="verilog-output"
|
| 84 |
)
|
|
|
|
| 85 |
copy_button = gr.Button("📋", variant="secondary", elem_id="copy-button")
|
| 86 |
-
|
| 87 |
with gr.Row():
|
| 88 |
clear_btn = gr.ClearButton(
|
| 89 |
value="Clear All",
|
|
@@ -132,13 +137,12 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
|
|
| 132 |
outputs=[],
|
| 133 |
js="""
|
| 134 |
(text) => {
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
})(document.createElement('textarea'));
|
| 142 |
}
|
| 143 |
"""
|
| 144 |
)
|
|
@@ -152,25 +156,32 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
|
|
| 152 |
letter-spacing: 1px;
|
| 153 |
}
|
| 154 |
|
| 155 |
-
/*
|
| 156 |
-
#
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
margin-bottom: 10px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 161 |
}
|
| 162 |
|
| 163 |
/* General UI element styling */
|
| 164 |
-
#verilog-output
|
| 165 |
position: relative;
|
|
|
|
| 166 |
}
|
| 167 |
-
|
| 168 |
#copy-button {
|
| 169 |
position: absolute;
|
| 170 |
-
top: 20px;
|
| 171 |
-
right:
|
| 172 |
z-index: 1000;
|
| 173 |
-
background-color:
|
| 174 |
color: #333;
|
| 175 |
border-radius: 5px;
|
| 176 |
border: none;
|
|
|
|
| 71 |
)
|
| 72 |
|
| 73 |
with gr.Column(scale=3):
|
| 74 |
+
# The logo and copy button are now managed with a single HTML block
|
| 75 |
+
gr.HTML("""
|
| 76 |
+
<div id="output-container">
|
| 77 |
+
<img src="file=DeepV_logo.png" id="deepv-logo" alt="DeepV Logo">
|
| 78 |
+
</div>
|
| 79 |
+
""")
|
| 80 |
|
| 81 |
+
# The output textbox is a standalone component
|
| 82 |
out_code = gr.Textbox(
|
| 83 |
label="Generated Verilog",
|
| 84 |
lines=28,
|
|
|
|
| 86 |
placeholder="// Your Verilog code will appear here",
|
| 87 |
elem_id="verilog-output"
|
| 88 |
)
|
| 89 |
+
|
| 90 |
copy_button = gr.Button("📋", variant="secondary", elem_id="copy-button")
|
| 91 |
+
|
| 92 |
with gr.Row():
|
| 93 |
clear_btn = gr.ClearButton(
|
| 94 |
value="Clear All",
|
|
|
|
| 137 |
outputs=[],
|
| 138 |
js="""
|
| 139 |
(text) => {
|
| 140 |
+
const el = document.createElement('textarea');
|
| 141 |
+
el.value = text;
|
| 142 |
+
document.body.appendChild(el);
|
| 143 |
+
el.select();
|
| 144 |
+
document.execCommand('copy');
|
| 145 |
+
document.body.removeChild(el);
|
|
|
|
| 146 |
}
|
| 147 |
"""
|
| 148 |
)
|
|
|
|
| 156 |
letter-spacing: 1px;
|
| 157 |
}
|
| 158 |
|
| 159 |
+
/* Container for logo and copy button */
|
| 160 |
+
#output-container {
|
| 161 |
+
display: flex;
|
| 162 |
+
justify-content: center;
|
| 163 |
+
align-items: center;
|
| 164 |
margin-bottom: 10px;
|
| 165 |
+
position: relative;
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
#deepv-logo {
|
| 169 |
+
width: 300px;
|
| 170 |
+
height: 85px;
|
| 171 |
}
|
| 172 |
|
| 173 |
/* General UI element styling */
|
| 174 |
+
#verilog-output {
|
| 175 |
position: relative;
|
| 176 |
+
padding-top: 50px; /* Add space for the copy button */
|
| 177 |
}
|
| 178 |
+
|
| 179 |
#copy-button {
|
| 180 |
position: absolute;
|
| 181 |
+
top: -20px;
|
| 182 |
+
right: 0px;
|
| 183 |
z-index: 1000;
|
| 184 |
+
background-color: transparent;
|
| 185 |
color: #333;
|
| 186 |
border-radius: 5px;
|
| 187 |
border: none;
|