Update app.py
Browse files
app.py
CHANGED
@@ -171,24 +171,10 @@ def update_datetime():
|
|
171 |
date, time = get_current_datetime()
|
172 |
return date, time
|
173 |
|
174 |
-
# Debug function to check logo file availability
|
175 |
-
def check_logo_file(logo_path):
|
176 |
-
print(f"Looking for logo at: {os.path.abspath(logo_path)}")
|
177 |
-
print(f"Logo file exists: {os.path.exists(logo_path)}")
|
178 |
-
print(f"Files in directory: {os.listdir()}")
|
179 |
-
return os.path.exists(logo_path)
|
180 |
|
181 |
-
# In your main function, before creating the UI:
|
182 |
-
# Ensure the static directory exists
|
183 |
-
os.makedirs("static", exist_ok=True)
|
184 |
-
|
185 |
-
# Copy the logo file to the static directory (if it's not already there)
|
186 |
src_logo = "Equinix-LOGO.jpeg"
|
187 |
-
dst_logo = os.path.join("static", "Equinix-LOGO.jpeg")
|
188 |
|
189 |
-
|
190 |
-
shutil.copy(src_logo, dst_logo)
|
191 |
-
print(f"Copied logo to {dst_logo}")
|
192 |
|
193 |
# Main function to create and launch the Gradio interface
|
194 |
def main():
|
@@ -197,62 +183,27 @@ def main():
|
|
197 |
retriever = initialize_retriever()
|
198 |
|
199 |
# Define custom CSS to style the logo and header
|
|
|
|
|
|
|
|
|
200 |
custom_css = """
|
201 |
-
|
202 |
-
|
203 |
-
background-color: black;
|
204 |
-
padding: 15px 0;
|
205 |
text-align: center;
|
206 |
-
margin-bottom: 20px;
|
207 |
}
|
208 |
-
|
209 |
-
#logo-image {
|
210 |
-
max-height: 80px;
|
211 |
-
margin: 0 auto;
|
212 |
display: block;
|
213 |
-
|
214 |
-
|
215 |
-
/* Hide download buttons and controls */
|
216 |
-
#logo-wrapper .svelte-1b6r3t8 {
|
217 |
-
display: none !important;
|
218 |
-
}
|
219 |
-
|
220 |
-
.gradio-container .wrap.svelte-19hvt5v {
|
221 |
-
display: none !important;
|
222 |
-
}
|
223 |
-
|
224 |
-
/* Hide any interactive elements in the header */
|
225 |
-
#header-container button,
|
226 |
-
#header-container .gr-button {
|
227 |
-
display: none !important;
|
228 |
-
}
|
229 |
-
|
230 |
-
/* Make date-time display more prominent */
|
231 |
-
.datetime-display input {
|
232 |
-
font-size: 16px;
|
233 |
-
text-align: center;
|
234 |
-
font-weight: bold;
|
235 |
}
|
236 |
"""
|
|
|
|
|
237 |
|
238 |
# Create the Gradio interface using Blocks
|
239 |
with gr.Blocks(css=custom_css) as demo:
|
240 |
-
|
241 |
-
with gr.Column():
|
242 |
-
if os.path.exists(dst_logo):
|
243 |
-
gr.HTML(f"""
|
244 |
-
<div style="text-align:center; background-color:black; padding:15px;">
|
245 |
-
<img src="/static/Equinix-LOGO.jpeg" alt="Equinix Logo" style="max-height:80px;">
|
246 |
-
</div>
|
247 |
-
""")
|
248 |
-
else:
|
249 |
-
# Fallback to text logo
|
250 |
-
gr.HTML("""
|
251 |
-
<div style="text-align:center; background-color:black; padding:15px;">
|
252 |
-
<div style="color:#FF0000; font-size:24px;">■■■■</div>
|
253 |
-
<div style="font-size:28px; letter-spacing:5px; margin-top:5px; color:white;">EQUINIX</div>
|
254 |
-
</div>
|
255 |
-
""")
|
256 |
|
257 |
# Title & Description
|
258 |
gr.Markdown("<h1 style='text-align: center; color: black;'>Equinix Chatbot for Automation Team</h1>")
|
|
|
171 |
date, time = get_current_datetime()
|
172 |
return date, time
|
173 |
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
|
|
|
|
|
|
|
|
|
|
|
175 |
src_logo = "Equinix-LOGO.jpeg"
|
|
|
176 |
|
177 |
+
|
|
|
|
|
178 |
|
179 |
# Main function to create and launch the Gradio interface
|
180 |
def main():
|
|
|
183 |
retriever = initialize_retriever()
|
184 |
|
185 |
# Define custom CSS to style the logo and header
|
186 |
+
# Define local image paths
|
187 |
+
logo_path = "Equinix-LOGO.jpeg" # Ensure this file exists
|
188 |
+
|
189 |
+
# Custom CSS for background styling
|
190 |
custom_css = """
|
191 |
+
.gradio-container {
|
192 |
+
background-color: #f0f0f0;
|
|
|
|
|
193 |
text-align: center;
|
|
|
194 |
}
|
195 |
+
#logo img {
|
|
|
|
|
|
|
196 |
display: block;
|
197 |
+
margin: 0 auto;
|
198 |
+
max-width: 200px; /* Adjust size */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
199 |
}
|
200 |
"""
|
201 |
+
|
202 |
+
|
203 |
|
204 |
# Create the Gradio interface using Blocks
|
205 |
with gr.Blocks(css=custom_css) as demo:
|
206 |
+
gr.Image(logo_path, elem_id="logo", show_label=False, height=200, width=500) # Display Logo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
|
208 |
# Title & Description
|
209 |
gr.Markdown("<h1 style='text-align: center; color: black;'>Equinix Chatbot for Automation Team</h1>")
|