Commit ·
e89a843
1
Parent(s): 76f4a65
fixing
Browse files
app.py
CHANGED
|
@@ -2,6 +2,23 @@ import os
|
|
| 2 |
import gradio as gr
|
| 3 |
from huggingface_hub import hf_hub_download
|
| 4 |
import importlib.util
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
# --- Private Repository Information ---
|
| 7 |
PRIVATE_DATASET_ID = os.getenv("PRIVATE_DATASET_ID")
|
|
@@ -19,8 +36,6 @@ try:
|
|
| 19 |
spec = importlib.util.spec_from_file_location("deepv_core_module", AGENT_CODE_PATH)
|
| 20 |
agent_module = importlib.util.module_from_spec(spec)
|
| 21 |
spec.loader.exec_module(agent_module)
|
| 22 |
-
|
| 23 |
-
# Now you can access the functions directly from the private module
|
| 24 |
run_generation = agent_module.run_generation
|
| 25 |
|
| 26 |
except Exception as e:
|
|
@@ -28,10 +43,9 @@ except Exception as e:
|
|
| 28 |
return f"// ERROR: Failed to load core agent code. Details: {e}", "", ""
|
| 29 |
|
| 30 |
# --- Gradio UI setup below ---
|
| 31 |
-
with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=
|
| 32 |
gr.Markdown("## DeepV for RTL Code Generation — Model-Agnostic (Bring Your Own API Key)")
|
| 33 |
|
| 34 |
-
# Status Bar for success/error messages
|
| 35 |
status_bar = gr.Textbox(
|
| 36 |
label="Status",
|
| 37 |
lines=1,
|
|
@@ -135,25 +149,20 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
|
|
| 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 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
border: none; /* Remove border */
|
| 156 |
-
box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Subtle shadow for depth */
|
| 157 |
}
|
| 158 |
"""
|
| 159 |
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
from huggingface_hub import hf_hub_download
|
| 4 |
import importlib.util
|
| 5 |
+
from gradio import themes
|
| 6 |
+
|
| 7 |
+
# --- Custom Theme ---
|
| 8 |
+
# Create a custom theme object
|
| 9 |
+
# This theme will have a different background for the input/output boxes
|
| 10 |
+
light_dark_theme = themes.Base(
|
| 11 |
+
primary_hue=themes.Color("indigo"),
|
| 12 |
+
secondary_hue=themes.Color("cyan"),
|
| 13 |
+
neutral_hue=themes.Color("gray")
|
| 14 |
+
).set(
|
| 15 |
+
background_fill_secondary_dark="#222", # Darker background for dark mode boxes
|
| 16 |
+
background_fill_secondary_light="#eee", # Lighter background for light mode boxes
|
| 17 |
+
button_primary_background_fill_dark="#4CAF50",
|
| 18 |
+
button_primary_background_fill_hover_dark="#3e8e41",
|
| 19 |
+
button_primary_text_color_dark="#fff"
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
|
| 23 |
# --- Private Repository Information ---
|
| 24 |
PRIVATE_DATASET_ID = os.getenv("PRIVATE_DATASET_ID")
|
|
|
|
| 36 |
spec = importlib.util.spec_from_file_location("deepv_core_module", AGENT_CODE_PATH)
|
| 37 |
agent_module = importlib.util.module_from_spec(spec)
|
| 38 |
spec.loader.exec_module(agent_module)
|
|
|
|
|
|
|
| 39 |
run_generation = agent_module.run_generation
|
| 40 |
|
| 41 |
except Exception as e:
|
|
|
|
| 43 |
return f"// ERROR: Failed to load core agent code. Details: {e}", "", ""
|
| 44 |
|
| 45 |
# --- Gradio UI setup below ---
|
| 46 |
+
with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=light_dark_theme) as demo:
|
| 47 |
gr.Markdown("## DeepV for RTL Code Generation — Model-Agnostic (Bring Your Own API Key)")
|
| 48 |
|
|
|
|
| 49 |
status_bar = gr.Textbox(
|
| 50 |
label="Status",
|
| 51 |
lines=1,
|
|
|
|
| 149 |
)
|
| 150 |
|
| 151 |
demo.css = """
|
|
|
|
| 152 |
#verilog-output > label > .label-wrap {
|
| 153 |
position: relative;
|
|
|
|
| 154 |
}
|
| 155 |
|
| 156 |
#copy-button {
|
| 157 |
position: absolute;
|
| 158 |
top: 20px;
|
| 159 |
right: 10px;
|
|
|
|
| 160 |
z-index: 1000;
|
| 161 |
+
background-color: #333;
|
| 162 |
+
color: #eee;
|
| 163 |
+
border-radius: 5px;
|
| 164 |
+
border: none;
|
| 165 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
|
|
|
|
|
| 166 |
}
|
| 167 |
"""
|
| 168 |
|