Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -79,22 +79,21 @@ def chat_logic(message, history, system_prompt, context, max_tokens, temperature
|
|
| 79 |
return "", history
|
| 80 |
|
| 81 |
# ==========================================
|
| 82 |
-
# 3. UI DESIGN (CLEAN
|
| 83 |
# ==========================================
|
| 84 |
|
| 85 |
CSS = """
|
| 86 |
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap');
|
| 87 |
|
| 88 |
-
/* --- GLOBAL
|
| 89 |
:root, .dark, body, .gradio-container {
|
| 90 |
--body-text-color: #000000 !important;
|
| 91 |
--body-background-fill: transparent !important;
|
| 92 |
-
--background-fill-primary: transparent !important;
|
| 93 |
--background-fill-secondary: transparent !important;
|
| 94 |
--block-background-fill: transparent !important;
|
| 95 |
--block-border-color: transparent !important;
|
| 96 |
--input-background-fill: #ffffff !important;
|
| 97 |
-
--color-accent-soft: transparent !important;
|
| 98 |
}
|
| 99 |
|
| 100 |
body {
|
|
@@ -108,45 +107,47 @@ body {
|
|
| 108 |
h1 { font-weight: 700 !important; color: #000000 !important; letter-spacing: -0.02em; }
|
| 109 |
p, span, label { color: #374151 !important; }
|
| 110 |
|
| 111 |
-
/* --- LEFT PANEL:
|
| 112 |
.config-card {
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
|
|
|
| 116 |
border-radius: 24px;
|
| 117 |
padding: 24px !important;
|
| 118 |
}
|
| 119 |
|
| 120 |
-
/*
|
| 121 |
-
.config-card
|
| 122 |
-
.config-card .gr-
|
| 123 |
.config-card .gr-box,
|
| 124 |
.config-card .gr-group,
|
| 125 |
-
.config-card .
|
|
|
|
| 126 |
background: transparent !important;
|
|
|
|
| 127 |
border: none !important;
|
| 128 |
box-shadow: none !important;
|
| 129 |
}
|
| 130 |
|
| 131 |
-
/*
|
| 132 |
.config-card textarea,
|
| 133 |
.config-card input[type="text"],
|
| 134 |
.config-card input[type="number"] {
|
| 135 |
background-color: #ffffff !important;
|
|
|
|
| 136 |
color: #000000 !important;
|
| 137 |
border: 1px solid #e5e7eb !important;
|
| 138 |
border-radius: 12px !important;
|
| 139 |
box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
|
| 140 |
}
|
| 141 |
|
| 142 |
-
/* Labels:
|
| 143 |
.config-card label span {
|
| 144 |
-
background: transparent !important;
|
| 145 |
color: #000000 !important;
|
| 146 |
font-weight: 700 !important;
|
| 147 |
font-size: 0.85rem !important;
|
| 148 |
-
|
| 149 |
-
margin-bottom: 5px !important;
|
| 150 |
}
|
| 151 |
|
| 152 |
/* Sliders */
|
|
@@ -156,7 +157,7 @@ input[type=range] {
|
|
| 156 |
|
| 157 |
/* --- RIGHT PANEL: CHAT WINDOW --- */
|
| 158 |
.chat-window {
|
| 159 |
-
background: rgba(255, 255, 255, 0.
|
| 160 |
border: 1px solid rgba(255, 255, 255, 0.9);
|
| 161 |
backdrop-filter: blur(20px);
|
| 162 |
border-radius: 24px;
|
|
@@ -174,7 +175,7 @@ input[type=range] {
|
|
| 174 |
.yellow { background-color: #ffbd2e; }
|
| 175 |
.green { background-color: #27c93f; }
|
| 176 |
|
| 177 |
-
/* Chatbot */
|
| 178 |
#chatbot {
|
| 179 |
background: transparent !important;
|
| 180 |
border: none !important;
|
|
@@ -206,19 +207,19 @@ input[type=range] {
|
|
| 206 |
color: #000000 !important;
|
| 207 |
}
|
| 208 |
|
| 209 |
-
/*
|
| 210 |
#send-btn {
|
| 211 |
-
background: transparent !important;
|
| 212 |
-
color: #000000 !important;
|
| 213 |
border: none !important;
|
| 214 |
box-shadow: none !important;
|
| 215 |
-
font-size: 1.
|
| 216 |
padding: 0 10px !important;
|
| 217 |
width: auto !important;
|
| 218 |
}
|
| 219 |
#send-btn:hover {
|
| 220 |
-
transform: translateX(3px);
|
| 221 |
-
color: #
|
| 222 |
}
|
| 223 |
|
| 224 |
/* Logos */
|
|
@@ -265,6 +266,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=CSS, title="Custom AI") as demo:
|
|
| 265 |
"""
|
| 266 |
)
|
| 267 |
|
|
|
|
| 268 |
with gr.Group(elem_classes="config-card"):
|
| 269 |
gr.Markdown("### ⚙️ Settings")
|
| 270 |
|
|
@@ -310,7 +312,6 @@ with gr.Blocks(theme=gr.themes.Soft(), css=CSS, title="Custom AI") as demo:
|
|
| 310 |
container=False,
|
| 311 |
autofocus=True
|
| 312 |
)
|
| 313 |
-
# El botón ahora es transparente, solo la flecha
|
| 314 |
send_btn = gr.Button("➝", scale=1, elem_id="send-btn")
|
| 315 |
|
| 316 |
inputs_list = [msg, chatbot, system_prompt_input, context_input, tokens_slider, temp_slider, top_p_slider]
|
|
|
|
| 79 |
return "", history
|
| 80 |
|
| 81 |
# ==========================================
|
| 82 |
+
# 3. UI DESIGN (FINAL CLEAN UP)
|
| 83 |
# ==========================================
|
| 84 |
|
| 85 |
CSS = """
|
| 86 |
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap');
|
| 87 |
|
| 88 |
+
/* --- GLOBAL TRANSPARENCY & RESET --- */
|
| 89 |
:root, .dark, body, .gradio-container {
|
| 90 |
--body-text-color: #000000 !important;
|
| 91 |
--body-background-fill: transparent !important;
|
| 92 |
+
--background-fill-primary: transparent !important; /* The culprit for dark blocks */
|
| 93 |
--background-fill-secondary: transparent !important;
|
| 94 |
--block-background-fill: transparent !important;
|
| 95 |
--block-border-color: transparent !important;
|
| 96 |
--input-background-fill: #ffffff !important;
|
|
|
|
| 97 |
}
|
| 98 |
|
| 99 |
body {
|
|
|
|
| 107 |
h1 { font-weight: 700 !important; color: #000000 !important; letter-spacing: -0.02em; }
|
| 108 |
p, span, label { color: #374151 !important; }
|
| 109 |
|
| 110 |
+
/* --- LEFT PANEL: TOTAL TRANSPARENCY --- */
|
| 111 |
.config-card {
|
| 112 |
+
/* Subtle glass effect, NO dark background */
|
| 113 |
+
background: rgba(255, 255, 255, 0.4) !important;
|
| 114 |
+
border: 1px solid rgba(255, 255, 255, 0.5) !important;
|
| 115 |
+
backdrop-filter: blur(10px);
|
| 116 |
border-radius: 24px;
|
| 117 |
padding: 24px !important;
|
| 118 |
}
|
| 119 |
|
| 120 |
+
/* NUCLEAR: Force every container inside the config card to be transparent */
|
| 121 |
+
.config-card div,
|
| 122 |
+
.config-card .gr-form,
|
| 123 |
.config-card .gr-box,
|
| 124 |
.config-card .gr-group,
|
| 125 |
+
.config-card .gr-block,
|
| 126 |
+
.config-card .gr-panel {
|
| 127 |
background: transparent !important;
|
| 128 |
+
background-color: transparent !important;
|
| 129 |
border: none !important;
|
| 130 |
box-shadow: none !important;
|
| 131 |
}
|
| 132 |
|
| 133 |
+
/* Inputs: Keep them White & Clean */
|
| 134 |
.config-card textarea,
|
| 135 |
.config-card input[type="text"],
|
| 136 |
.config-card input[type="number"] {
|
| 137 |
background-color: #ffffff !important;
|
| 138 |
+
opacity: 1 !important; /* Ensure they stay opaque */
|
| 139 |
color: #000000 !important;
|
| 140 |
border: 1px solid #e5e7eb !important;
|
| 141 |
border-radius: 12px !important;
|
| 142 |
box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
|
| 143 |
}
|
| 144 |
|
| 145 |
+
/* Labels: Clean Black Text */
|
| 146 |
.config-card label span {
|
|
|
|
| 147 |
color: #000000 !important;
|
| 148 |
font-weight: 700 !important;
|
| 149 |
font-size: 0.85rem !important;
|
| 150 |
+
margin-bottom: 4px !important;
|
|
|
|
| 151 |
}
|
| 152 |
|
| 153 |
/* Sliders */
|
|
|
|
| 157 |
|
| 158 |
/* --- RIGHT PANEL: CHAT WINDOW --- */
|
| 159 |
.chat-window {
|
| 160 |
+
background: rgba(255, 255, 255, 0.95) !important;
|
| 161 |
border: 1px solid rgba(255, 255, 255, 0.9);
|
| 162 |
backdrop-filter: blur(20px);
|
| 163 |
border-radius: 24px;
|
|
|
|
| 175 |
.yellow { background-color: #ffbd2e; }
|
| 176 |
.green { background-color: #27c93f; }
|
| 177 |
|
| 178 |
+
/* Chatbot Area */
|
| 179 |
#chatbot {
|
| 180 |
background: transparent !important;
|
| 181 |
border: none !important;
|
|
|
|
| 207 |
color: #000000 !important;
|
| 208 |
}
|
| 209 |
|
| 210 |
+
/* Button: Minimalist Black Arrow */
|
| 211 |
#send-btn {
|
| 212 |
+
background: transparent !important;
|
| 213 |
+
color: #000000 !important;
|
| 214 |
border: none !important;
|
| 215 |
box-shadow: none !important;
|
| 216 |
+
font-size: 1.6rem;
|
| 217 |
padding: 0 10px !important;
|
| 218 |
width: auto !important;
|
| 219 |
}
|
| 220 |
#send-btn:hover {
|
| 221 |
+
transform: translateX(3px);
|
| 222 |
+
color: #333;
|
| 223 |
}
|
| 224 |
|
| 225 |
/* Logos */
|
|
|
|
| 266 |
"""
|
| 267 |
)
|
| 268 |
|
| 269 |
+
# Aquí aplicamos la clase config-card, pero el CSS ahora fuerza transparencia total dentro
|
| 270 |
with gr.Group(elem_classes="config-card"):
|
| 271 |
gr.Markdown("### ⚙️ Settings")
|
| 272 |
|
|
|
|
| 312 |
container=False,
|
| 313 |
autofocus=True
|
| 314 |
)
|
|
|
|
| 315 |
send_btn = gr.Button("➝", scale=1, elem_id="send-btn")
|
| 316 |
|
| 317 |
inputs_list = [msg, chatbot, system_prompt_input, context_input, tokens_slider, temp_slider, top_p_slider]
|