Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,60 +1,171 @@
|
|
1 |
-
# This is a simple Gradio app that embeds an iframe to display an external Hugging Face Space.
|
2 |
-
# It also includes a fallback link in case the Deepfake Detector doesn't work.
|
3 |
-
# Additionally, it adds cards on the left and right to include links to more spaces.
|
4 |
-
|
5 |
import gradio as gr
|
6 |
|
7 |
-
# Define the CSS to embed the iframe and style the cards
|
8 |
css = """
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
.iframe-container {
|
10 |
position: relative;
|
11 |
width: 100%;
|
12 |
height: 0;
|
13 |
-
padding-bottom:
|
|
|
|
|
|
|
|
|
14 |
}
|
|
|
15 |
.iframe-container iframe {
|
16 |
position: absolute;
|
17 |
top: 0;
|
18 |
left: 0;
|
19 |
width: 100%;
|
20 |
height: 100%;
|
21 |
-
border:
|
|
|
22 |
}
|
|
|
|
|
23 |
.card {
|
24 |
-
background
|
|
|
25 |
padding: 20px;
|
26 |
-
margin: 10px;
|
27 |
-
border-radius:
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
}
|
30 |
"""
|
31 |
|
32 |
-
# Create a Gradio Blocks app
|
33 |
with gr.Blocks(css=css) as demo:
|
34 |
-
|
35 |
-
|
|
|
|
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
|
|
|
|
49 |
|
50 |
-
|
51 |
-
|
52 |
-
gr.
|
53 |
-
|
54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
-
|
57 |
-
|
|
|
|
|
58 |
|
59 |
-
|
60 |
-
demo.launch(show_error=True)
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
|
|
3 |
css = """
|
4 |
+
/* Container styles */
|
5 |
+
.container {
|
6 |
+
max-width: 1200px;
|
7 |
+
margin: 0 auto;
|
8 |
+
padding: 20px;
|
9 |
+
}
|
10 |
+
|
11 |
+
/* Header styles */
|
12 |
+
h1, h2, h3 {
|
13 |
+
font-family: 'Arial', sans-serif;
|
14 |
+
color: #2d3748;
|
15 |
+
}
|
16 |
+
|
17 |
+
/* Iframe container styles */
|
18 |
.iframe-container {
|
19 |
position: relative;
|
20 |
width: 100%;
|
21 |
height: 0;
|
22 |
+
padding-bottom: 75%;
|
23 |
+
background: #f7fafc;
|
24 |
+
border-radius: 12px;
|
25 |
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
26 |
+
overflow: hidden;
|
27 |
}
|
28 |
+
|
29 |
.iframe-container iframe {
|
30 |
position: absolute;
|
31 |
top: 0;
|
32 |
left: 0;
|
33 |
width: 100%;
|
34 |
height: 100%;
|
35 |
+
border: none;
|
36 |
+
border-radius: 12px;
|
37 |
}
|
38 |
+
|
39 |
+
/* Card styles */
|
40 |
.card {
|
41 |
+
background: linear-gradient(145deg, #1a365d, #2d4a8c);
|
42 |
+
color: white;
|
43 |
padding: 20px;
|
44 |
+
margin: 10px 0;
|
45 |
+
border-radius: 12px;
|
46 |
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
47 |
+
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
48 |
+
}
|
49 |
+
|
50 |
+
.card:hover {
|
51 |
+
transform: translateY(-5px);
|
52 |
+
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
|
53 |
+
}
|
54 |
+
|
55 |
+
.card a {
|
56 |
+
color: white;
|
57 |
+
text-decoration: none;
|
58 |
+
font-weight: bold;
|
59 |
+
font-size: 1.1em;
|
60 |
+
display: block;
|
61 |
+
padding: 10px;
|
62 |
+
}
|
63 |
+
|
64 |
+
.card a:hover {
|
65 |
+
text-decoration: underline;
|
66 |
+
}
|
67 |
+
|
68 |
+
/* Fallback link styles */
|
69 |
+
.fallback-link {
|
70 |
+
margin-top: 20px;
|
71 |
+
padding: 15px;
|
72 |
+
background-color: #f8f9fa;
|
73 |
+
border-radius: 8px;
|
74 |
+
border: 1px solid #e2e8f0;
|
75 |
+
}
|
76 |
+
|
77 |
+
.fallback-link a {
|
78 |
+
color: #4a5568;
|
79 |
+
text-decoration: none;
|
80 |
+
font-weight: 500;
|
81 |
+
}
|
82 |
+
|
83 |
+
.fallback-link a:hover {
|
84 |
+
color: #2b6cb0;
|
85 |
+
}
|
86 |
+
|
87 |
+
/* Icon styles */
|
88 |
+
.icon {
|
89 |
+
width: 50px;
|
90 |
+
height: 50px;
|
91 |
+
margin-bottom: 20px;
|
92 |
+
}
|
93 |
+
|
94 |
+
/* Layout styles */
|
95 |
+
.column {
|
96 |
+
padding: 10px;
|
97 |
+
}
|
98 |
+
|
99 |
+
.row {
|
100 |
+
display: flex;
|
101 |
+
align-items: stretch;
|
102 |
+
margin: -10px;
|
103 |
+
}
|
104 |
+
|
105 |
+
/* Responsive design */
|
106 |
+
@media (max-width: 768px) {
|
107 |
+
.row {
|
108 |
+
flex-direction: column;
|
109 |
+
}
|
110 |
+
|
111 |
+
.column {
|
112 |
+
width: 100%;
|
113 |
+
}
|
114 |
+
|
115 |
+
.iframe-container {
|
116 |
+
padding-bottom: 100%;
|
117 |
+
}
|
118 |
}
|
119 |
"""
|
120 |
|
|
|
121 |
with gr.Blocks(css=css) as demo:
|
122 |
+
with gr.Row(elem_classes=["container"]):
|
123 |
+
gr.Image("https://raw.githubusercontent.com/noumanjavaid96/ai-as-an-api/refs/heads/master/image%20(39).png",
|
124 |
+
elem_classes=["icon"])
|
125 |
+
gr.Markdown("# Centurion Complete Demo", elem_classes=["header"])
|
126 |
|
127 |
+
with gr.Row(elem_classes=["row"]):
|
128 |
+
with gr.Column(elem_classes=["column"]):
|
129 |
+
gr.Markdown("### Featured Tools", elem_classes=["section-title"])
|
130 |
+
gr.HTML('''
|
131 |
+
<div class="card">
|
132 |
+
<a href="https://noumanjavaid-new-space.hf.space" target="_blank">
|
133 |
+
🔍 DeepFake Detection
|
134 |
+
</a>
|
135 |
+
</div>
|
136 |
+
<div class="card">
|
137 |
+
<a href="https://noumanjavaid-centurionv2.hf.space" target="_blank">
|
138 |
+
📄 Image and Document Diff Checker
|
139 |
+
</a>
|
140 |
+
</div>
|
141 |
+
''')
|
142 |
|
143 |
+
with gr.Column(scale=2, elem_classes=["column"]):
|
144 |
+
gr.HTML('''
|
145 |
+
<div class="iframe-container">
|
146 |
+
<iframe src="https://noumanjavaid-centii.hf.space"></iframe>
|
147 |
+
</div>
|
148 |
+
''')
|
149 |
|
150 |
+
with gr.Column(elem_classes=["column"]):
|
151 |
+
gr.Markdown("### Additional Tools", elem_classes=["section-title"])
|
152 |
+
gr.HTML('''
|
153 |
+
<div class="card">
|
154 |
+
<a href="https://noumanjavaid-watermark-demo-video.hf.space" target="_blank">
|
155 |
+
🎥 Video Watermarking
|
156 |
+
</a>
|
157 |
+
</div>
|
158 |
+
<div class="card">
|
159 |
+
<a href="https://space4.hf.space" target="_blank">
|
160 |
+
🚧 UNDER CONSTRUCTION
|
161 |
+
</a>
|
162 |
+
</div>
|
163 |
+
''')
|
164 |
|
165 |
+
with gr.Row(elem_classes=["fallback-link"]):
|
166 |
+
gr.Markdown("""
|
167 |
+
ℹ️ If the Deepfake Detector is not loading, please [click here](https://noumanjavaid-new-space.hf.space) to access it directly.
|
168 |
+
""")
|
169 |
|
170 |
+
if __name__ == "__main__":
|
171 |
+
demo.launch(show_error=True)
|