Upload app.py
Browse files
app.py
CHANGED
@@ -20,141 +20,91 @@ def chatbot_response(message):
|
|
20 |
response = query_engine.query(message)
|
21 |
return str(response)
|
22 |
|
23 |
-
# Custom CSS for purple button styling
|
24 |
custom_css = """
|
25 |
-
/* Target
|
26 |
-
button,
|
27 |
-
.
|
28 |
-
.
|
29 |
-
.
|
30 |
-
input[type="submit"],
|
31 |
-
.submit-btn {
|
32 |
background: linear-gradient(45deg, #8B5CF6, #A855F7) !important;
|
33 |
border: none !important;
|
34 |
color: white !important;
|
35 |
border-radius: 8px !important;
|
36 |
}
|
37 |
|
38 |
-
button:hover,
|
39 |
-
.
|
40 |
-
.
|
41 |
-
.
|
42 |
-
input[type="submit"]:hover,
|
43 |
-
.submit-btn:hover {
|
44 |
background: linear-gradient(45deg, #7C3AED, #9333EA) !important;
|
45 |
transform: translateY(-2px) !important;
|
46 |
box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3) !important;
|
47 |
transition: all 0.2s ease !important;
|
48 |
}
|
49 |
|
50 |
-
/*
|
51 |
-
.
|
52 |
-
.gradio-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
.gradio-container .btn:hover {
|
60 |
-
background: linear-gradient(45deg, #7C3AED, #9333EA) !important;
|
61 |
-
}
|
62 |
-
|
63 |
-
/* Target by CSS classes that might be used */
|
64 |
-
.primary,
|
65 |
-
.btn-primary,
|
66 |
-
.gr-button-primary {
|
67 |
-
background: linear-gradient(45deg, #8B5CF6, #A855F7) !important;
|
68 |
-
border: none !important;
|
69 |
-
color: white !important;
|
70 |
-
}
|
71 |
-
|
72 |
-
.primary:hover,
|
73 |
-
.btn-primary:hover,
|
74 |
-
.gr-button-primary:hover {
|
75 |
-
background: linear-gradient(45deg, #7C3AED, #9333EA) !important;
|
76 |
-
}
|
77 |
-
|
78 |
-
/* Very specific targeting for submit-like buttons */
|
79 |
-
button[aria-label*="Submit"],
|
80 |
-
button[title*="Submit"],
|
81 |
-
.submit,
|
82 |
-
.gr-form button {
|
83 |
-
background: linear-gradient(45deg, #8B5CF6, #A855F7) !important;
|
84 |
-
border: none !important;
|
85 |
-
color: white !important;
|
86 |
}
|
87 |
|
88 |
-
|
89 |
-
.gradio-button.
|
90 |
-
.
|
91 |
-
button.
|
92 |
-
background:
|
93 |
-
|
94 |
-
|
95 |
}
|
96 |
|
97 |
-
/* Example buttons */
|
|
|
|
|
98 |
.examples button,
|
99 |
-
.examples .
|
100 |
-
.examples .gr-button {
|
101 |
background: white !important;
|
102 |
-
color:
|
103 |
border: 1px solid #D1D5DB !important;
|
104 |
border-radius: 8px !important;
|
105 |
}
|
106 |
|
|
|
|
|
107 |
.examples button:hover,
|
108 |
-
.examples .
|
109 |
-
|
110 |
-
|
111 |
-
color: black !important;
|
112 |
border-color: #9CA3AF !important;
|
113 |
transform: translateY(-1px) !important;
|
114 |
}
|
115 |
|
116 |
-
/*
|
117 |
-
.
|
118 |
-
.
|
119 |
-
.
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
.examples button span,
|
125 |
-
.examples .btn span,
|
126 |
-
.examples .gr-button span,
|
127 |
-
.examples button div,
|
128 |
-
.examples .btn div,
|
129 |
-
.examples .gr-button div {
|
130 |
-
color: black !important;
|
131 |
-
}
|
132 |
-
|
133 |
-
/* Nuclear option - force ALL text in examples to be black */
|
134 |
-
.examples,
|
135 |
-
.examples * {
|
136 |
-
color: black !important;
|
137 |
-
}
|
138 |
-
|
139 |
-
/* Alternative approach - target by data attributes or specific classes */
|
140 |
-
[data-testid*="example"] button,
|
141 |
-
[data-testid*="example"] * {
|
142 |
-
color: black !important;
|
143 |
}
|
144 |
|
145 |
-
/*
|
146 |
-
.
|
147 |
-
.
|
148 |
-
|
149 |
-
|
150 |
-
color:
|
151 |
-
border: 1px solid #D1D5DB !important;
|
152 |
}
|
153 |
|
154 |
-
.
|
155 |
-
.
|
156 |
-
|
157 |
-
background: #F3F4F6 !important;
|
158 |
}
|
159 |
"""
|
160 |
|
|
|
20 |
response = query_engine.query(message)
|
21 |
return str(response)
|
22 |
|
23 |
+
# Custom CSS for purple button styling - Only target main action buttons
|
24 |
custom_css = """
|
25 |
+
/* Target only main action buttons (Submit/Clear) - not example buttons */
|
26 |
+
button.primary,
|
27 |
+
.gradio-button.primary,
|
28 |
+
button.lg.primary,
|
29 |
+
button.svelte-cmf5ev.primary {
|
|
|
|
|
30 |
background: linear-gradient(45deg, #8B5CF6, #A855F7) !important;
|
31 |
border: none !important;
|
32 |
color: white !important;
|
33 |
border-radius: 8px !important;
|
34 |
}
|
35 |
|
36 |
+
button.primary:hover,
|
37 |
+
.gradio-button.primary:hover,
|
38 |
+
button.lg.primary:hover,
|
39 |
+
button.svelte-cmf5ev.primary:hover {
|
|
|
|
|
40 |
background: linear-gradient(45deg, #7C3AED, #9333EA) !important;
|
41 |
transform: translateY(-2px) !important;
|
42 |
box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3) !important;
|
43 |
transition: all 0.2s ease !important;
|
44 |
}
|
45 |
|
46 |
+
/* Secondary buttons (like Clear) - keep them distinguishable */
|
47 |
+
button.secondary,
|
48 |
+
.gradio-button.secondary,
|
49 |
+
button.lg.secondary,
|
50 |
+
button.svelte-cmf5ev.secondary {
|
51 |
+
background: #E5E7EB !important;
|
52 |
+
color: #374151 !important;
|
53 |
+
border: 1px solid #D1D5DB !important;
|
54 |
+
border-radius: 8px !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
}
|
56 |
|
57 |
+
button.secondary:hover,
|
58 |
+
.gradio-button.secondary:hover,
|
59 |
+
button.lg.secondary:hover,
|
60 |
+
button.svelte-cmf5ev.secondary:hover {
|
61 |
+
background: #F3F4F6 !important;
|
62 |
+
color: #374151 !important;
|
63 |
+
transform: translateY(-1px) !important;
|
64 |
}
|
65 |
|
66 |
+
/* Example buttons - ensure they have proper contrast */
|
67 |
+
.gallery-item,
|
68 |
+
button.gallery-item,
|
69 |
.examples button,
|
70 |
+
.examples .gallery-item {
|
|
|
71 |
background: white !important;
|
72 |
+
color: #374151 !important;
|
73 |
border: 1px solid #D1D5DB !important;
|
74 |
border-radius: 8px !important;
|
75 |
}
|
76 |
|
77 |
+
.gallery-item:hover,
|
78 |
+
button.gallery-item:hover,
|
79 |
.examples button:hover,
|
80 |
+
.examples .gallery-item:hover {
|
81 |
+
background: #F9FAFB !important;
|
82 |
+
color: #374151 !important;
|
|
|
83 |
border-color: #9CA3AF !important;
|
84 |
transform: translateY(-1px) !important;
|
85 |
}
|
86 |
|
87 |
+
/* Force text color in example buttons to be dark */
|
88 |
+
.gallery-item,
|
89 |
+
.gallery-item *,
|
90 |
+
button.gallery-item,
|
91 |
+
button.gallery-item *,
|
92 |
+
.examples button,
|
93 |
+
.examples button * {
|
94 |
+
color: #374151 !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
}
|
96 |
|
97 |
+
/* Specific targeting for HF Spaces compatibility */
|
98 |
+
.gradio-container button.primary,
|
99 |
+
.gradio-container .primary {
|
100 |
+
background: linear-gradient(45deg, #8B5CF6, #A855F7) !important;
|
101 |
+
border: none !important;
|
102 |
+
color: white !important;
|
|
|
103 |
}
|
104 |
|
105 |
+
.gradio-container button.primary:hover,
|
106 |
+
.gradio-container .primary:hover {
|
107 |
+
background: linear-gradient(45deg, #7C3AED, #9333EA) !important;
|
|
|
108 |
}
|
109 |
"""
|
110 |
|