paulcalzada commited on
Commit
6d29ea4
·
verified ·
1 Parent(s): 1cab2c1

Update app.py

Browse files

replace accordion with texts

Files changed (1) hide show
  1. app.py +6 -24
app.py CHANGED
@@ -29,9 +29,6 @@ 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
- # This state variable will track the visibility of the settings
33
- settings_visible = gr.State(False)
34
-
35
  with gr.Row():
36
  with gr.Column(scale=2):
37
  with gr.Row():
@@ -57,15 +54,12 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
57
  with gr.Row():
58
  use_rag = gr.Checkbox(value=True, label="Use Retrieval (RAG)")
59
  top_k = gr.Slider(1, 10, value=3, step=1, label="Top-K retrieved examples")
60
-
61
- # --- New UI for Generation Settings ---
62
- toggle_btn = gr.Button("Show/Hide Generation Settings", size="sm")
63
 
64
- settings_column = gr.Column(visible=False)
65
- with settings_column:
66
- temperature = gr.Slider(0.0, 1.5, value=0.2, step=0.05, label="Temperature")
67
- top_p = gr.Slider(0.1, 1.0, value=0.9, step=0.05, label="Top-p")
68
- max_new_tokens = gr.Slider(128, 4096, value=768, step=64, label="Max tokens")
69
 
70
  # --- Loading State Components ---
71
  with gr.Row():
@@ -103,18 +97,6 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
103
  )
104
  return verilog_code
105
 
106
- # --- Function to toggle the visibility using a state variable ---
107
- def toggle_visibility(state):
108
- new_state = not state
109
- return new_state, gr.update(visible=new_state)
110
-
111
- # --- Event listeners for the UI ---
112
- toggle_btn.click(
113
- fn=toggle_visibility,
114
- inputs=[settings_visible],
115
- outputs=[settings_visible, settings_column]
116
- )
117
-
118
  def copy_to_clipboard_fn(text):
119
  return text
120
 
@@ -131,7 +113,7 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
131
  show_progress=False
132
  ).then(
133
  fn=generate_only,
134
- inputs=[spec, use_rag, top_k, model_choice, api_key, temperature, top_p, max_new_tokens],
135
  outputs=[out_code],
136
  ).then(
137
  fn=hide_loading,
 
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():
 
54
  with gr.Row():
55
  use_rag = gr.Checkbox(value=True, label="Use Retrieval (RAG)")
56
  top_k = gr.Slider(1, 10, value=3, step=1, label="Top-K retrieved examples")
 
 
 
57
 
58
+ # --- New UI with three text boxes for generation settings ---
59
+ with gr.Row():
60
+ temperature_tb = gr.Textbox(label="Temperature", value="0.2", scale=1)
61
+ top_p_tb = gr.Textbox(label="Top-p", value="0.9", scale=1)
62
+ max_new_tokens_tb = gr.Textbox(label="Max tokens", value="768", scale=1)
63
 
64
  # --- Loading State Components ---
65
  with gr.Row():
 
97
  )
98
  return verilog_code
99
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  def copy_to_clipboard_fn(text):
101
  return text
102
 
 
113
  show_progress=False
114
  ).then(
115
  fn=generate_only,
116
+ inputs=[spec, use_rag, top_k, model_choice, api_key, temperature_tb, top_p_tb, max_new_tokens_tb],
117
  outputs=[out_code],
118
  ).then(
119
  fn=hide_loading,