noumanjavaid's picture
Update app.py
c4c21ca verified
raw
history blame
4.68 kB
import gradio as gr
import logging
import os
from dotenv import load_dotenv
# Load environment variables
load_dotenv()
# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
logger = logging.getLogger(__name__)
# CSS Configuration
css = """
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background-color: #ffffff;
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}
.header {
background: #00000;
border-bottom: 1px solid #e5e5e5;
padding: 1.5rem 2rem;
display: flex;
align-items: center;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
margin-bottom: 2rem;
}
.logo {
width: 100px;
height: 45px;
margin-right: 0px;
transition: transform 0.3s ease;
}
.logo:hover {
transform: scale(1.05);
}
.header-title {
color: #000000;
font-size: 24px;
font-weight: 600;
}
.container {
max-width: 1400px;
margin: 0 auto;
padding: 0 2rem;
}
.main-content {
background: #00000;
border-radius: 12px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
margin-bottom: 2rem;
overflow: hidden;
border: 1px solid #e5e5e5;
}
.iframe-container {
position: relative;
width: 100%;
height: 0;
padding-bottom: 65%;
}
.iframe-container iframe {
position: absolute;
top: 0;
left: 0;
width: 1000px;
height: 1000px;
border: none;
}
.nav-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(1000px, 1fr));
gap: 1.5rem;
margin: 2rem 0;
}
.nav-card {
background: #ffffff;
border: 10px solid #e5e5e5;
border-radius: 10px;
padding: 1.5rem;
transition: all 0.3s ease;
}
.nav-card:hover {
transform: translateY(-5px);
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
border-color: #000000;
}
.nav-card a {
color: #000000;
text-decoration: none;
font-weight: 500;
font-size: 1.1rem;
display: flex;
align-items: center;
gap: 0.8rem;
}
.nav-card a::after {
content: 'β†’';
margin-left: auto;
opacity: 0;
transition: opacity 0.3s ease;
}
.nav-card:hover a::after {
opacity: 1;
}
/* Hide Gradio elements */
footer {
display: none !important;
}
.gradio-container {
margin: 0 !important;
padding: 0 !important;
}
@media (max-width: 768px) {
.nav-grid {
grid-template-columns: 1fr;
}
.header {
padding: 1rem;
}
.container {
padding: 0 1rem;
}
}
"""
# Navigation cards configuration
NAVIGATION_CARDS = [
{
"icon": "πŸ”",
"title": "DeepFake Detection",
"url": "https://noumanjavaid-new-space.hf.space"
},
{
"icon": "πŸ“„",
"title": "Document Analysis",
"url": "https://noumanjavaid-centurionv2.hf.space"
},
{
"icon": "πŸŽ₯",
"title": "Video Watermarking",
"url": "https://noumanjavaid-watermark-demo-video.hf.space"
},
{
"icon": "πŸ”",
"title": "Image Authentication",
"url": "https://noumanjavaid-centii.hf.space"
}
]
def create_navigation_cards():
return "".join([
f'''
<div class="nav-card">
<a href="{card['url']}" target="_blank" rel="noopener noreferrer">
{card['icon']} {card['title']}
</a>
</div>
''' for card in NAVIGATION_CARDS
])
def create_interface():
with gr.Blocks(css=css, title="Centurion Analysis Platform") as demo:
# Header
with gr.Row(elem_classes=["header"]):
gr.Image(
"https://raw.githubusercontent.com/noumanjavaid96/ai-as-an-api/refs/heads/master/image%20(39).png",
elem_classes=["logo"],
show_label=False,
container=False
)
gr.Markdown("Centurion Analysis", elem_classes=["header-title"])
# Main content
with gr.Row(elem_classes=["container"]):
with gr.Column(elem_classes=["main-content"]):
gr.HTML('''
<div class="iframe-container">
<iframe
src="https://noumanjavaid-centii.hf.space"
title="Centurion Main Platform"
></iframe>
</div>
''')
# Navigation grid
with gr.Row(elem_classes=["nav-grid"]):
gr.HTML(create_navigation_cards())
return demo
if __name__ == "__main__":
demo = create_interface()
demo.launch(
show_error=False,
show_api=False,
)