File size: 4,478 Bytes
9ed22a3
1aa8799
3e8fb84
 
9ed22a3
3e8fb84
 
 
bc18442
1aa8799
bc18442
 
1aa8799
 
 
3e8fb84
3d75008
3e8fb84
3d75008
ab3b5d9
3d75008
 
 
ab3b5d9
7fa2fb1
ab3b5d9
3d75008
 
 
 
 
ab3b5d9
7fa2fb1
ab3b5d9
3d75008
 
ab3b5d9
7fa2fb1
3d75008
62e7c5a
3d75008
 
 
 
ab3b5d9
7fa2fb1
3d75008
 
 
62e7c5a
7fa2fb1
3d75008
 
 
 
9ed22a3
7fa2fb1
3d75008
ab3b5d9
 
3d75008
 
 
62e7c5a
7fa2fb1
ab3b5d9
7fa2fb1
 
 
 
 
 
 
 
 
62e7c5a
7fa2fb1
bc18442
7fa2fb1
 
3e8fb84
7fa2fb1
 
 
 
 
bc18442
7fa2fb1
 
 
 
bc18442
7fa2fb1
bc18442
 
 
 
7fa2fb1
 
 
 
 
bc18442
 
 
7fa2fb1
3e8fb84
 
 
 
 
 
 
7fa2fb1
 
3e8fb84
 
7fa2fb1
 
3e8fb84
7fa2fb1
 
3e8fb84
7fa2fb1
 
3e8fb84
7fa2fb1
 
 
3e8fb84
7fa2fb1
 
e5a9fde
7fa2fb1
 
 
 
 
3e8fb84
 
7fa2fb1
 
 
 
 
 
 
 
 
 
f57745e
55dee05
36078a7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
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 = """
/* General Styles */
body {
    font-family: sans-serif;
    background-color: #f8f8f8; /* Light background for better contrast */
    color: #333; /* Darker text color */
}

.header {
    background-color: #fff; /* White header */
    padding: 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #eee;
}

.logo {
    max-height: 80px;
    margin-right: 30px;
}

/* Main Content Area */
.container {
    padding: 30px;
    background-color: #fff; /* White container background */
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); /* Add a subtle shadow */
}

.main-content, .image-upload-area {
    padding: 20px;  /* Add padding around content sections */
    border: none;  /* Remove borders */
}

/* Image Upload */
.image-upload-area .gradio-file-upload { /* Style individual file upload components */
    border: 1px solid #ddd;
    border-radius: 5px;
}

/* Navigation Grid */
.nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px;
}

.nav-card {
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 25px;       /* Increased padding */
    display: flex;          
    align-items: center;    
    text-decoration: none; /* Remove underline from links */
    color: #333;          /* Darker text color */
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out; /* Combined transitions */
}

.nav-card:hover {
    transform: translateY(-5px); 
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.nav-card i {
    font-size: 2.5em;     /* Larger icons */
    margin-right: 15px;
    color: #4285f4;     /* Google blue for icons (optional) */
}

.nav-card span {
    font-size: 1.4em;       /* Larger text */
    font-weight: 500;      
}

"""

# 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"},
    {"icon": "πŸ–ΌοΈ", "title": "Image Comparison", "url": "https://another-example.com"} # Added example
]

def create_interface():
    with gr.Blocks(css=css, title="Centurion") as demo:
        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("<h2 style='margin:0;'>Centurion</h2>") # Improved title style

        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"  /* Set initial iframe URL */
                            title="Centurion Main Platform"
                            id="main-iframe"  /* Add id for targeting with JavaScript */
                       ></iframe>
                    </div>
                    """
                )  # Close HTML string properly

            with gr.Row(elem_classes=["nav-grid"]):
                for card in NAVIGATION_CARDS:
                    gr.HTML(f"""
                        <a href="{card['url']}" onclick="updateIframe('{card['url']}'); return false;" class="nav-card">
                            <i>{card['icon']}</i> <span>{card['title']}</span>
                        </a>
                    """)


    return demo



# JavaScript function to update iframe source

js = """
function updateIframe(url) {
    document.getElementById('main-iframe').src = url;
}
"""

if __name__ == "__main__":
    demo = create_interface()
    demo.launch(show_error=False, show_api=False)