noumanjavaid commited on
Commit
62e7c5a
·
verified ·
1 Parent(s): aa62d14

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +145 -34
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: 53.33%; /* 450 / 850 * 100 */
 
 
 
 
14
  }
 
15
  .iframe-container iframe {
16
  position: absolute;
17
  top: 0;
18
  left: 0;
19
  width: 100%;
20
  height: 100%;
21
- border: 10px;
 
22
  }
 
 
23
  .card {
24
- background-color: #f0f0f0;
 
25
  padding: 20px;
26
- margin: 10px;
27
- border-radius: 10px;
28
- text-align: center;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  }
30
  """
31
 
32
- # Create a Gradio Blocks app
33
  with gr.Blocks(css=css) as demo:
34
- # Add a Markdown component to provide some context
35
- gr.Markdown("## Centurion Complete Demo")
 
 
36
 
37
- # Add a Row to contain the cards and the iframe
38
- with gr.Row():
39
- # Add a card on the left
40
- with gr.Column():
41
- gr.Markdown("### More Spaces")
42
- gr.HTML('<div class="card"><a href="https://noumanjavaid-new-space.hf.space" target="_blank">DeepFake Detection</a></div>')
43
- gr.HTML('<div class="card"><a href="https://noumanjavaid-centurionv2.hf.space" target="_blank">Image and Document Diff Checker</a></div>')
 
 
 
 
 
 
 
 
44
 
45
- # Add a Column to contain the iframe
46
- with gr.Column():
47
- # Add a HTML component to embed the iframe
48
- gr.HTML('<div class="iframe-container"><iframe src="https://noumanjavaid-centii.hf.space"></iframe></div>')
 
 
49
 
50
- # Add a card on the right
51
- with gr.Column():
52
- gr.Markdown("### More Spaces")
53
- gr.HTML('<div class="card"><a href="https://noumanjavaid-watermark-demo-video.hf.space" target="_blank">Space 3</a></div>')
54
- gr.HTML('<div class="card"><a href="https://space4.hf.space" target="_blank">Space 4</a></div>')
 
 
 
 
 
 
 
 
 
55
 
56
- # Add a Markdown component to provide a fallback link
57
- gr.Markdown("If the Deepfake Detector doesn't work, please use the following link: [Deepfake Detector](https://noumanjavaid-new-space.hf.space)")
 
 
58
 
59
- # Launch the app
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)