Spaces:
Sleeping
Sleeping
Commit
·
31142c0
1
Parent(s):
420b66d
Update app.py
Browse files
app.py
CHANGED
|
@@ -47,13 +47,13 @@ def respond(message, history, system_message, max_tokens, temperature, top_p, se
|
|
| 47 |
print(f"Error calling model API: {e}")
|
| 48 |
yield f"Sorry, there was an error: {str(e)}"
|
| 49 |
|
| 50 |
-
# Custom CSS for branding with
|
| 51 |
css = """
|
| 52 |
-
@import url('https://fonts.googleapis.com/css2?family=
|
| 53 |
|
| 54 |
body {
|
| 55 |
-
background-color: #
|
| 56 |
-
font-family: '
|
| 57 |
max-width: 100%;
|
| 58 |
overflow-x: hidden;
|
| 59 |
}
|
|
@@ -71,6 +71,7 @@ body {
|
|
| 71 |
position: relative;
|
| 72 |
color: white;
|
| 73 |
overflow: hidden;
|
|
|
|
| 74 |
}
|
| 75 |
.app-header::before {
|
| 76 |
content: "🛡️";
|
|
@@ -87,14 +88,14 @@ body {
|
|
| 87 |
margin: 0;
|
| 88 |
display: flex;
|
| 89 |
align-items: center;
|
| 90 |
-
font-family: '
|
| 91 |
}
|
| 92 |
.app-title .safe {
|
| 93 |
-
font-weight:
|
| 94 |
margin-right: 5px;
|
| 95 |
}
|
| 96 |
.app-title .lm {
|
| 97 |
-
font-weight:
|
| 98 |
letter-spacing: 1px;
|
| 99 |
}
|
| 100 |
.app-title .shield {
|
|
@@ -106,10 +107,6 @@ body {
|
|
| 106 |
opacity: 0.9;
|
| 107 |
margin-top: 5px;
|
| 108 |
}
|
| 109 |
-
.golden-accent {
|
| 110 |
-
border-top: 2px solid #e6c200;
|
| 111 |
-
margin: 0;
|
| 112 |
-
}
|
| 113 |
button, .gradio-button {
|
| 114 |
background: linear-gradient(to right, #4a90e2, #75c6ef) !important;
|
| 115 |
color: white !important;
|
|
@@ -118,7 +115,7 @@ button, .gradio-button {
|
|
| 118 |
padding: 8px 16px !important;
|
| 119 |
font-weight: 600 !important;
|
| 120 |
transition: all 0.3s ease !important;
|
| 121 |
-
font-family: '
|
| 122 |
}
|
| 123 |
button:hover, .gradio-button:hover {
|
| 124 |
transform: translateY(-1px) !important;
|
|
@@ -127,38 +124,65 @@ button:hover, .gradio-button:hover {
|
|
| 127 |
.gradio-dropdown, .gradio-slider, .gradio-textbox, .gradio-checkbox {
|
| 128 |
border-radius: 8px !important;
|
| 129 |
border: 1px solid #e1e5eb !important;
|
| 130 |
-
font-family: '
|
| 131 |
}
|
| 132 |
.model-select {
|
| 133 |
border-left: 3px solid #e6c200 !important;
|
| 134 |
padding-left: 8px !important;
|
| 135 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
.chatbot .assistant-message::before {
|
| 137 |
content: "🛡️ ";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
}
|
| 139 |
.chatbot .user-message {
|
| 140 |
-
|
| 141 |
-
border-radius: 8px !important;
|
| 142 |
}
|
| 143 |
.chatbot .assistant-message {
|
| 144 |
-
|
| 145 |
-
border-radius: 8px !important;
|
| 146 |
}
|
| 147 |
#chatbot {
|
| 148 |
height: 400px !important;
|
| 149 |
overflow-y: auto !important;
|
|
|
|
|
|
|
|
|
|
| 150 |
}
|
| 151 |
-
|
| 152 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
}
|
| 154 |
-
|
| 155 |
-
|
|
|
|
| 156 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
|
| 158 |
"""
|
| 159 |
|
| 160 |
with gr.Blocks(css=css) as demo:
|
| 161 |
-
# Custom header with branding
|
| 162 |
gr.HTML("""
|
| 163 |
<div class="app-header">
|
| 164 |
<h1 class="app-title">
|
|
@@ -168,7 +192,6 @@ with gr.Blocks(css=css) as demo:
|
|
| 168 |
</h1>
|
| 169 |
<p class="app-subtitle">Responsible AI for everyone</p>
|
| 170 |
</div>
|
| 171 |
-
<hr class="golden-accent">
|
| 172 |
""")
|
| 173 |
|
| 174 |
with gr.Row():
|
|
@@ -287,4 +310,16 @@ with gr.Blocks(css=css) as demo:
|
|
| 287 |
clear_button.click(clear_history, None, chatbot, queue=False)
|
| 288 |
|
| 289 |
if __name__ == "__main__":
|
| 290 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
print(f"Error calling model API: {e}")
|
| 48 |
yield f"Sorry, there was an error: {str(e)}"
|
| 49 |
|
| 50 |
+
# Custom CSS for branding with consistent styling
|
| 51 |
css = """
|
| 52 |
+
@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:wght@400;500;600;700&display=swap');
|
| 53 |
|
| 54 |
body {
|
| 55 |
+
background-color: #ffffff;
|
| 56 |
+
font-family: 'Crimson Pro', 'Palatino', serif;
|
| 57 |
max-width: 100%;
|
| 58 |
overflow-x: hidden;
|
| 59 |
}
|
|
|
|
| 71 |
position: relative;
|
| 72 |
color: white;
|
| 73 |
overflow: hidden;
|
| 74 |
+
border-bottom: 3px solid #e6c200;
|
| 75 |
}
|
| 76 |
.app-header::before {
|
| 77 |
content: "🛡️";
|
|
|
|
| 88 |
margin: 0;
|
| 89 |
display: flex;
|
| 90 |
align-items: center;
|
| 91 |
+
font-family: 'Crimson Pro', serif;
|
| 92 |
}
|
| 93 |
.app-title .safe {
|
| 94 |
+
font-weight: 700;
|
| 95 |
margin-right: 5px;
|
| 96 |
}
|
| 97 |
.app-title .lm {
|
| 98 |
+
font-weight: 400;
|
| 99 |
letter-spacing: 1px;
|
| 100 |
}
|
| 101 |
.app-title .shield {
|
|
|
|
| 107 |
opacity: 0.9;
|
| 108 |
margin-top: 5px;
|
| 109 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
button, .gradio-button {
|
| 111 |
background: linear-gradient(to right, #4a90e2, #75c6ef) !important;
|
| 112 |
color: white !important;
|
|
|
|
| 115 |
padding: 8px 16px !important;
|
| 116 |
font-weight: 600 !important;
|
| 117 |
transition: all 0.3s ease !important;
|
| 118 |
+
font-family: 'Crimson Pro', serif !important;
|
| 119 |
}
|
| 120 |
button:hover, .gradio-button:hover {
|
| 121 |
transform: translateY(-1px) !important;
|
|
|
|
| 124 |
.gradio-dropdown, .gradio-slider, .gradio-textbox, .gradio-checkbox {
|
| 125 |
border-radius: 8px !important;
|
| 126 |
border: 1px solid #e1e5eb !important;
|
| 127 |
+
font-family: 'Crimson Pro', serif !important;
|
| 128 |
}
|
| 129 |
.model-select {
|
| 130 |
border-left: 3px solid #e6c200 !important;
|
| 131 |
padding-left: 8px !important;
|
| 132 |
}
|
| 133 |
+
/* Clean chat styling without background colors */
|
| 134 |
+
.chatbot .user-message::before {
|
| 135 |
+
content: "👤 ";
|
| 136 |
+
font-size: 16px;
|
| 137 |
+
}
|
| 138 |
.chatbot .assistant-message::before {
|
| 139 |
content: "🛡️ ";
|
| 140 |
+
font-size: 16px;
|
| 141 |
+
}
|
| 142 |
+
.chatbot .user-message, .chatbot .assistant-message {
|
| 143 |
+
background-color: transparent !important;
|
| 144 |
+
border-radius: 0 !important;
|
| 145 |
+
padding: 10px !important;
|
| 146 |
+
border-bottom: 1px solid #f0f0f0 !important;
|
| 147 |
+
font-family: 'Crimson Pro', serif !important;
|
| 148 |
+
font-size: 16px !important;
|
| 149 |
}
|
| 150 |
.chatbot .user-message {
|
| 151 |
+
color: #333333 !important;
|
|
|
|
| 152 |
}
|
| 153 |
.chatbot .assistant-message {
|
| 154 |
+
color: #1a73e8 !important;
|
|
|
|
| 155 |
}
|
| 156 |
#chatbot {
|
| 157 |
height: 400px !important;
|
| 158 |
overflow-y: auto !important;
|
| 159 |
+
border: 1px solid #e1e5eb !important;
|
| 160 |
+
border-radius: 8px !important;
|
| 161 |
+
background-color: #ffffff !important;
|
| 162 |
}
|
| 163 |
+
/* Footer hiding */
|
| 164 |
+
.footer, #footer, .gradio-footer, #component-38, #component-39 {
|
| 165 |
+
display: none !important;
|
| 166 |
+
visibility: hidden !important;
|
| 167 |
+
height: 0 !important;
|
| 168 |
+
width: 0 !important;
|
| 169 |
+
margin: 0 !important;
|
| 170 |
+
padding: 0 !important;
|
| 171 |
+
opacity: 0 !important;
|
| 172 |
}
|
| 173 |
+
/* Hide Gradio branding */
|
| 174 |
+
.gradio-container > div:last-child {
|
| 175 |
+
display: none !important;
|
| 176 |
}
|
| 177 |
+
.gradio-container .footer-logo, .gradio-container footer {
|
| 178 |
+
display: none !important;
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
|
| 182 |
"""
|
| 183 |
|
| 184 |
with gr.Blocks(css=css) as demo:
|
| 185 |
+
# Custom header with branding - removed the hr element
|
| 186 |
gr.HTML("""
|
| 187 |
<div class="app-header">
|
| 188 |
<h1 class="app-title">
|
|
|
|
| 192 |
</h1>
|
| 193 |
<p class="app-subtitle">Responsible AI for everyone</p>
|
| 194 |
</div>
|
|
|
|
| 195 |
""")
|
| 196 |
|
| 197 |
with gr.Row():
|
|
|
|
| 310 |
clear_button.click(clear_history, None, chatbot, queue=False)
|
| 311 |
|
| 312 |
if __name__ == "__main__":
|
| 313 |
+
# Launch with custom footer_html to remove the "Built with Gradio" text
|
| 314 |
+
demo.launch(
|
| 315 |
+
show_api=False, # Hide the API button
|
| 316 |
+
share=False, # Don't create a public link
|
| 317 |
+
debug=False, # Hide debug info
|
| 318 |
+
enable_queue=True,
|
| 319 |
+
show_error=True,
|
| 320 |
+
favicon_path=None,
|
| 321 |
+
height="auto",
|
| 322 |
+
width="100%",
|
| 323 |
+
# Empty footer to hide "Built with Gradio"
|
| 324 |
+
footer_html=""
|
| 325 |
+
)
|