paulcalzada commited on
Commit
55d395d
·
verified ·
1 Parent(s): e0f0abd

Update app.py

Browse files

have logo but remove any animation on it

Files changed (1) hide show
  1. app.py +14 -89
app.py CHANGED
@@ -71,17 +71,11 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
71
  )
72
 
73
  with gr.Column(scale=3):
74
- # --- DeepV Logo and "Output" text (Correctly configured gr.Image) ---
75
- with gr.Row(elem_id="logo-and-output-row"):
76
- # Use gr.HTML with correct relative paths for local files.
77
- gr.HTML("""
78
- <div id="logo-container">
79
- <img src="file=DeepV_logo.png" id="deepv-base-logo" alt="DeepV Logo">
80
- <div id="deep-part" class="logo-overlay"></div>
81
- </div>
82
- """)
83
- gr.Markdown("**Output**", elem_id="output-title")
84
-
85
  with gr.Group():
86
  out_code = gr.Textbox(
87
  label="Generated Verilog",
@@ -110,43 +104,26 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
110
  def copy_to_clipboard_fn(text):
111
  return text
112
 
113
- def show_loading():
 
114
  return [gr.update(visible=False), gr.update(visible=True)]
115
 
116
- def hide_loading():
117
  return [gr.update(visible=True), gr.update(visible=False)]
118
 
119
  run_btn.click(
120
- fn=show_loading,
121
  inputs=[],
122
  outputs=[run_btn, loading_state],
123
  show_progress=False,
124
- js="""
125
- (e) => {
126
- var deepPart = document.getElementById('deep-part');
127
- if (deepPart) {
128
- deepPart.classList.add('deep-hop-away');
129
- }
130
- }
131
- """
132
  ).then(
133
  fn=generate_only,
134
  inputs=[spec, use_rag, top_k, model_choice, api_key, temperature_tb, top_p_tb, max_new_tokens_tb],
135
  outputs=[out_code],
136
  ).then(
137
- fn=hide_loading,
138
  inputs=[],
139
  outputs=[run_btn, loading_state],
140
- js="""
141
- (e) => {
142
- var deepPart = document.getElementById('deep-part');
143
- if (deepPart) {
144
- deepPart.classList.remove('deep-hop-away');
145
- // This line forces the browser to re-render, ensuring the animation resets
146
- void deepPart.offsetWidth;
147
- }
148
- }
149
- """
150
  )
151
 
152
  clear_btn.click(fn=lambda: "Ready", outputs=[])
@@ -178,65 +155,13 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
178
  letter-spacing: 1px;
179
  }
180
 
181
- /* Logo and Output Row Layout */
182
- #logo-and-output-row {
183
  display: flex;
184
  align-items: center;
185
- justify-content: center;
186
  margin-bottom: 10px;
187
- height: 80px; /* Give space for animation */
188
- }
189
-
190
- /* Logo container for relative positioning of layers */
191
- #logo-container {
192
- position: relative;
193
- width: 250px; /* Set a fixed size for the container */
194
- height: 70px;
195
- display: flex;
196
- justify-content: center;
197
- align-items: center;
198
- overflow: hidden;
199
- }
200
-
201
- #deepv-base-logo {
202
- position: absolute;
203
- width: 100%;
204
- height: 100%;
205
- object-fit: contain;
206
- z-index: 1; /* Base logo layer */
207
- }
208
-
209
- #deep-part {
210
- position: absolute;
211
- top: 0;
212
- left: 0;
213
- width: 100%;
214
- height: 100%;
215
- /* CORRECTED: Use a URL that Gradio can resolve for assets */
216
- background-image: url('file=DeepV_logo.png');
217
- background-size: contain;
218
- background-repeat: no-repeat;
219
- background-position: center;
220
- z-index: 2; /* Layer on top for animation */
221
-
222
- /* Use clip-path to show only the "DEEP" blue part */
223
- /* You may need to adjust these percentages based on your specific logo dimensions */
224
- clip-path: inset(0% 40% 0% 0%);
225
- transform: translateY(0); /* Initial state */
226
- transition: transform 0.8s ease-in-out, opacity 0.8s ease-in-out;
227
- }
228
-
229
- /* Animation for DEEP part hopping away */
230
- .deep-hop-away {
231
- transform: translateY(-150%) scale(0.8) !important;
232
- opacity: 0 !important;
233
- }
234
-
235
- #output-title {
236
- margin: 0;
237
- font-size: 1.2em;
238
- font-weight: bold;
239
- margin-left: 20px;
240
  }
241
 
242
  /* General UI element styling */
 
71
  )
72
 
73
  with gr.Column(scale=3):
74
+ # --- DeepV Logo instead of "Output" text ---
75
+ with gr.Row(elem_id="logo-row"): # Changed ID for clarity
76
+ # Display the logo directly using gr.Image
77
+ gr.Image("DeepV_logo.png", width=250, height=70, contain=True, show_label=False, elem_id="deepv-logo")
78
+
 
 
 
 
 
 
79
  with gr.Group():
80
  out_code = gr.Textbox(
81
  label="Generated Verilog",
 
104
  def copy_to_clipboard_fn(text):
105
  return text
106
 
107
+ # We can simplify show_loading/hide_loading as animation JS is removed
108
+ def show_loading_no_anim():
109
  return [gr.update(visible=False), gr.update(visible=True)]
110
 
111
+ def hide_loading_no_anim():
112
  return [gr.update(visible=True), gr.update(visible=False)]
113
 
114
  run_btn.click(
115
+ fn=show_loading_no_anim,
116
  inputs=[],
117
  outputs=[run_btn, loading_state],
118
  show_progress=False,
 
 
 
 
 
 
 
 
119
  ).then(
120
  fn=generate_only,
121
  inputs=[spec, use_rag, top_k, model_choice, api_key, temperature_tb, top_p_tb, max_new_tokens_tb],
122
  outputs=[out_code],
123
  ).then(
124
+ fn=hide_loading_no_anim,
125
  inputs=[],
126
  outputs=[run_btn, loading_state],
 
 
 
 
 
 
 
 
 
 
127
  )
128
 
129
  clear_btn.click(fn=lambda: "Ready", outputs=[])
 
155
  letter-spacing: 1px;
156
  }
157
 
158
+ /* Simplified logo row styling */
159
+ #logo-row {
160
  display: flex;
161
  align-items: center;
162
+ justify-content: center; /* Center the logo */
163
  margin-bottom: 10px;
164
+ height: 80px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
  }
166
 
167
  /* General UI element styling */