Upload gradio_theme_fenix.py with huggingface_hub
Browse files- gradio_theme_fenix.py +71 -0
gradio_theme_fenix.py
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
# Simple CSS that follows the visual guidelines (white background, dark blue accents)
|
| 5 |
+
FENIX_CSS = """
|
| 6 |
+
body {
|
| 7 |
+
background-color: #ffffff;
|
| 8 |
+
color: #000000;
|
| 9 |
+
}
|
| 10 |
+
.gradio-container {
|
| 11 |
+
max-width: 1200px;
|
| 12 |
+
margin: auto;
|
| 13 |
+
}
|
| 14 |
+
.fenix-header {
|
| 15 |
+
text-align: center;
|
| 16 |
+
font-family: 'Roboto', sans-serif;
|
| 17 |
+
color: #1A3E5C;
|
| 18 |
+
margin-bottom: 20px;
|
| 19 |
+
}
|
| 20 |
+
.fenix-header h1 {
|
| 21 |
+
font-size: 24px;
|
| 22 |
+
font-weight: 700;
|
| 23 |
+
margin: 0;
|
| 24 |
+
}
|
| 25 |
+
.fenix-header p {
|
| 26 |
+
font-size: 14px;
|
| 27 |
+
margin: 5px 0 0 0;
|
| 28 |
+
}
|
| 29 |
+
.fenix-footer {
|
| 30 |
+
text-align: center;
|
| 31 |
+
font-size: 12px;
|
| 32 |
+
color: #777777;
|
| 33 |
+
margin-top: 30px;
|
| 34 |
+
padding-top: 10px;
|
| 35 |
+
border-top: 1px solid #e0e0e0;
|
| 36 |
+
}
|
| 37 |
+
"""
|
| 38 |
+
|
| 39 |
+
def apply_fenix_theme():
|
| 40 |
+
"""
|
| 41 |
+
Returns a Gradio theme object. We start from the Soft theme and
|
| 42 |
+
customize primary/secondary colors to match the dark blue accent.
|
| 43 |
+
"""
|
| 44 |
+
return gr.themes.Soft(
|
| 45 |
+
primary_hue="indigo",
|
| 46 |
+
secondary_hue="indigo",
|
| 47 |
+
font=("Roboto", "sans-serif")
|
| 48 |
+
)
|
| 49 |
+
|
| 50 |
+
def fenix_header(title: str, subtitle: str):
|
| 51 |
+
"""
|
| 52 |
+
Header component placed at the top of the app.
|
| 53 |
+
"""
|
| 54 |
+
html = f'''
|
| 55 |
+
<div class="fenix-header">
|
| 56 |
+
<h1>{title}</h1>
|
| 57 |
+
<p>{subtitle}</p>
|
| 58 |
+
</div>
|
| 59 |
+
'''
|
| 60 |
+
return gr.HTML(html)
|
| 61 |
+
|
| 62 |
+
def fenix_footer():
|
| 63 |
+
"""
|
| 64 |
+
Footer component placed at the bottom of the app.
|
| 65 |
+
"""
|
| 66 |
+
html = '''
|
| 67 |
+
<div class="fenix-footer">
|
| 68 |
+
© 2024 PDF Voice Reader - Powered by Gradio & ElevenLabs
|
| 69 |
+
</div>
|
| 70 |
+
'''
|
| 71 |
+
return gr.HTML(html)
|