Unizomby commited on
Commit
0676c43
·
verified ·
1 Parent(s): d660823

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +53 -103
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 all possible Gradio button selectors */
26
- button,
27
- .btn,
28
- .gr-button,
29
- .gradio-button,
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
- .btn:hover,
40
- .gr-button:hover,
41
- .gradio-button:hover,
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
- /* Specific targeting for different Gradio versions */
51
- .gradio-container button,
52
- .gradio-container .btn {
53
- background: linear-gradient(45deg, #8B5CF6, #A855F7) !important;
54
- border: none !important;
55
- color: white !important;
56
- }
57
-
58
- .gradio-container button:hover,
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
- /* Override any orange/default styling */
89
- .gradio-button.primary,
90
- .btn.primary,
91
- button.primary {
92
- background: linear-gradient(45deg, #8B5CF6, #A855F7) !important;
93
- border: none !important;
94
- color: white !important;
95
  }
96
 
97
- /* Example buttons */
 
 
98
  .examples button,
99
- .examples .btn,
100
- .examples .gr-button {
101
  background: white !important;
102
- color: black !important;
103
  border: 1px solid #D1D5DB !important;
104
  border-radius: 8px !important;
105
  }
106
 
 
 
107
  .examples button:hover,
108
- .examples .btn:hover,
109
- .examples .gr-button:hover {
110
- background: #F3F4F6 !important;
111
- color: black !important;
112
  border-color: #9CA3AF !important;
113
  transform: translateY(-1px) !important;
114
  }
115
 
116
- /* More specific targeting for example button text */
117
- .examples button *,
118
- .examples .btn *,
119
- .examples .gr-button * {
120
- color: black !important;
121
- }
122
-
123
- /* Target any nested elements that might contain the text */
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
- /* Clear/secondary buttons */
146
- .secondary,
147
- .btn-secondary,
148
- .gr-button-secondary {
149
- background: #E5E7EB !important;
150
- color: #374151 !important;
151
- border: 1px solid #D1D5DB !important;
152
  }
153
 
154
- .secondary:hover,
155
- .btn-secondary:hover,
156
- .gr-button-secondary:hover {
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