Update app.py
Browse files
app.py
CHANGED
|
@@ -29,6 +29,9 @@ 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)", elem_id="main-title")
|
| 31 |
|
|
|
|
|
|
|
|
|
|
| 32 |
with gr.Row():
|
| 33 |
with gr.Column(scale=2):
|
| 34 |
with gr.Row():
|
|
@@ -72,12 +75,11 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
|
|
| 72 |
|
| 73 |
with gr.Column(scale=3):
|
| 74 |
# The logo is now an HTML component for maximum style control
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
out_code = gr.Textbox(
|
| 82 |
label="Generated Verilog",
|
| 83 |
lines=28,
|
|
@@ -93,7 +95,19 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
|
|
| 93 |
value="Clear All",
|
| 94 |
components=[spec, out_code, temperature_tb, top_p_tb, max_new_tokens_tb]
|
| 95 |
)
|
| 96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
# --- Wrapper function to handle output from the generation agent ---
|
| 98 |
def generate_only(
|
| 99 |
spec, use_rag, top_k, model_choice, api_key, temperature, top_p, max_new_tokens
|
|
@@ -155,7 +169,6 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
|
|
| 155 |
letter-spacing: 1px;
|
| 156 |
}
|
| 157 |
|
| 158 |
-
/* Container for a clean, simple logo display */
|
| 159 |
#deepv-logo-container {
|
| 160 |
display: flex;
|
| 161 |
justify-content: center;
|
|
|
|
| 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)", elem_id="main-title")
|
| 31 |
|
| 32 |
+
# The logo file component is now hidden
|
| 33 |
+
logo_file = gr.File("DeepV_logo.png", visible=False)
|
| 34 |
+
|
| 35 |
with gr.Row():
|
| 36 |
with gr.Column(scale=2):
|
| 37 |
with gr.Row():
|
|
|
|
| 75 |
|
| 76 |
with gr.Column(scale=3):
|
| 77 |
# The logo is now an HTML component for maximum style control
|
| 78 |
+
# The HTML source is dynamically updated
|
| 79 |
+
logo_html = gr.HTML(
|
| 80 |
+
"<div id='deepv-logo-container'><img id='deepv-logo' src='' alt='DeepV Logo'></div>"
|
| 81 |
+
)
|
| 82 |
+
|
|
|
|
| 83 |
out_code = gr.Textbox(
|
| 84 |
label="Generated Verilog",
|
| 85 |
lines=28,
|
|
|
|
| 95 |
value="Clear All",
|
| 96 |
components=[spec, out_code, temperature_tb, top_p_tb, max_new_tokens_tb]
|
| 97 |
)
|
| 98 |
+
|
| 99 |
+
# --- Dynamic Logo Update ---
|
| 100 |
+
demo.load(
|
| 101 |
+
lambda path: gr.HTML(f"""
|
| 102 |
+
<div id='deepv-logo-container'>
|
| 103 |
+
<img id='deepv-logo' src='file={path}' alt='DeepV Logo'>
|
| 104 |
+
</div>
|
| 105 |
+
"""),
|
| 106 |
+
inputs=logo_file,
|
| 107 |
+
outputs=logo_html,
|
| 108 |
+
show_progress=False
|
| 109 |
+
)
|
| 110 |
+
|
| 111 |
# --- Wrapper function to handle output from the generation agent ---
|
| 112 |
def generate_only(
|
| 113 |
spec, use_rag, top_k, model_choice, api_key, temperature, top_p, max_new_tokens
|
|
|
|
| 169 |
letter-spacing: 1px;
|
| 170 |
}
|
| 171 |
|
|
|
|
| 172 |
#deepv-logo-container {
|
| 173 |
display: flex;
|
| 174 |
justify-content: center;
|