Commit ·
9750507
1
Parent(s): e1cd8a1
added copy to clipboard
Browse files
app.py
CHANGED
|
@@ -85,12 +85,18 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)") as demo:
|
|
| 85 |
run_btn = gr.Button("Generate Verilog", variant="primary")
|
| 86 |
with gr.Column(scale=3):
|
| 87 |
gr.Markdown("**Output**")
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
with gr.Tab("Retrieved Items (names + scores)"):
|
| 95 |
retrieved_list = gr.Textbox(
|
| 96 |
label="Retriever summary",
|
|
@@ -106,6 +112,14 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)") as demo:
|
|
| 106 |
outputs=[out_code, retrieved_list, retrieved_raw]
|
| 107 |
)
|
| 108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
if __name__ == "__main__":
|
| 110 |
if 'agent_module' in locals():
|
| 111 |
demo.launch()
|
|
|
|
| 85 |
run_btn = gr.Button("Generate Verilog", variant="primary")
|
| 86 |
with gr.Column(scale=3):
|
| 87 |
gr.Markdown("**Output**")
|
| 88 |
+
with gr.Row():
|
| 89 |
+
out_code = gr.Textbox(
|
| 90 |
+
label="Generated Verilog (copy-ready)",
|
| 91 |
+
lines=28,
|
| 92 |
+
interactive=False,
|
| 93 |
+
placeholder="// Your Verilog code will appear here"
|
| 94 |
+
)
|
| 95 |
+
# The copy button is added here
|
| 96 |
+
copy_button = gr.Button("📋", scale=0)
|
| 97 |
+
# You can use a more explicit label if you prefer:
|
| 98 |
+
# copy_button = gr.Button("Copy Code", scale=0)
|
| 99 |
+
|
| 100 |
with gr.Tab("Retrieved Items (names + scores)"):
|
| 101 |
retrieved_list = gr.Textbox(
|
| 102 |
label="Retriever summary",
|
|
|
|
| 112 |
outputs=[out_code, retrieved_list, retrieved_raw]
|
| 113 |
)
|
| 114 |
|
| 115 |
+
# --- Copy button functionality ---
|
| 116 |
+
# This code snippet is a powerful way to add custom behavior without a backend function
|
| 117 |
+
copy_button.click(
|
| 118 |
+
None,
|
| 119 |
+
_js="(text) => navigator.clipboard.writeText(text)",
|
| 120 |
+
inputs=[out_code]
|
| 121 |
+
)
|
| 122 |
+
|
| 123 |
if __name__ == "__main__":
|
| 124 |
if 'agent_module' in locals():
|
| 125 |
demo.launch()
|