Spaces:
Sleeping
Sleeping
Fix mobile visibility and add global token input with submit button
Browse files
app.py
CHANGED
|
@@ -151,6 +151,23 @@ custom_css = """
|
|
| 151 |
border-radius: 8px;
|
| 152 |
padding: 15px;
|
| 153 |
height: 100%;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
}
|
| 155 |
/* Mobile responsiveness */
|
| 156 |
@media (max-width: 768px) {
|
|
@@ -160,6 +177,9 @@ custom_css = """
|
|
| 160 |
.chatbot-container {
|
| 161 |
margin-top: 10px;
|
| 162 |
}
|
|
|
|
|
|
|
|
|
|
| 163 |
}
|
| 164 |
"""
|
| 165 |
|
|
@@ -170,28 +190,46 @@ with gr.Blocks(title="Sherlock: AI Project Assistant", theme=gr.themes.Soft(), c
|
|
| 170 |
Your intelligent assistant for managing multiple projects through meeting summaries.
|
| 171 |
""")
|
| 172 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
# Main tabs
|
| 174 |
with gr.Tabs():
|
| 175 |
# Chat tab
|
| 176 |
with gr.Tab("💬 Chat"):
|
| 177 |
gr.Markdown("### Ask questions about your projects")
|
| 178 |
|
| 179 |
-
# HuggingFace Token input
|
| 180 |
-
with gr.Row():
|
| 181 |
-
with gr.Column(scale=3):
|
| 182 |
-
hf_token_chat = gr.Textbox(
|
| 183 |
-
label="🔑 HuggingFace Token (Required)",
|
| 184 |
-
placeholder="Enter your HF token from https://huggingface.co/settings/tokens",
|
| 185 |
-
type="password"
|
| 186 |
-
)
|
| 187 |
-
with gr.Column(scale=1):
|
| 188 |
-
gr.Markdown("""
|
| 189 |
-
**Get a free token:**
|
| 190 |
-
1. Go to [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens)
|
| 191 |
-
2. Create a new token with "Read" permissions
|
| 192 |
-
3. Paste it here
|
| 193 |
-
""")
|
| 194 |
-
|
| 195 |
# Project selection dropdown
|
| 196 |
project_dropdown = gr.Dropdown(
|
| 197 |
label="Select Project",
|
|
@@ -253,13 +291,13 @@ with gr.Blocks(title="Sherlock: AI Project Assistant", theme=gr.themes.Soft(), c
|
|
| 253 |
|
| 254 |
submit_btn.click(
|
| 255 |
fn=respond,
|
| 256 |
-
inputs=[msg, chatbot, project_dropdown,
|
| 257 |
outputs=[chatbot, msg]
|
| 258 |
)
|
| 259 |
|
| 260 |
msg.submit(
|
| 261 |
fn=respond,
|
| 262 |
-
inputs=[msg, chatbot, project_dropdown,
|
| 263 |
outputs=[chatbot, msg]
|
| 264 |
)
|
| 265 |
|
|
@@ -269,13 +307,6 @@ with gr.Blocks(title="Sherlock: AI Project Assistant", theme=gr.themes.Soft(), c
|
|
| 269 |
with gr.Tab("📤 Upload Meeting"):
|
| 270 |
gr.Markdown("### Upload plain text meeting notes and let AI structure them")
|
| 271 |
|
| 272 |
-
# HuggingFace Token input
|
| 273 |
-
hf_token_upload = gr.Textbox(
|
| 274 |
-
label="🔑 HuggingFace Token (Required)",
|
| 275 |
-
placeholder="Enter your HF token from https://huggingface.co/settings/tokens",
|
| 276 |
-
type="password"
|
| 277 |
-
)
|
| 278 |
-
|
| 279 |
# Project selection with toggle
|
| 280 |
with gr.Row():
|
| 281 |
with gr.Column():
|
|
@@ -347,7 +378,7 @@ Charlie is blocked waiting for API credentials.""",
|
|
| 347 |
|
| 348 |
structure_btn.click(
|
| 349 |
fn=structure_meeting_wrapper,
|
| 350 |
-
inputs=[project_mode, existing_project, new_project, upload_title, upload_date, upload_participants, upload_text,
|
| 351 |
outputs=structure_output
|
| 352 |
)
|
| 353 |
|
|
|
|
| 151 |
border-radius: 8px;
|
| 152 |
padding: 15px;
|
| 153 |
height: 100%;
|
| 154 |
+
color: #1f2937 !important;
|
| 155 |
+
}
|
| 156 |
+
.example-panel h3 {
|
| 157 |
+
color: #1f2937 !important;
|
| 158 |
+
}
|
| 159 |
+
.example-panel p, .example-panel li {
|
| 160 |
+
color: #374151 !important;
|
| 161 |
+
}
|
| 162 |
+
.token-status {
|
| 163 |
+
padding: 10px;
|
| 164 |
+
border-radius: 5px;
|
| 165 |
+
margin-top: 10px;
|
| 166 |
+
font-weight: bold;
|
| 167 |
+
}
|
| 168 |
+
.token-accepted {
|
| 169 |
+
background-color: #d1fae5;
|
| 170 |
+
color: #065f46;
|
| 171 |
}
|
| 172 |
/* Mobile responsiveness */
|
| 173 |
@media (max-width: 768px) {
|
|
|
|
| 177 |
.chatbot-container {
|
| 178 |
margin-top: 10px;
|
| 179 |
}
|
| 180 |
+
.example-panel {
|
| 181 |
+
color: #1f2937 !important;
|
| 182 |
+
}
|
| 183 |
}
|
| 184 |
"""
|
| 185 |
|
|
|
|
| 190 |
Your intelligent assistant for managing multiple projects through meeting summaries.
|
| 191 |
""")
|
| 192 |
|
| 193 |
+
# Global HuggingFace Token input
|
| 194 |
+
gr.Markdown("### 🔑 Authentication")
|
| 195 |
+
with gr.Row():
|
| 196 |
+
with gr.Column(scale=3):
|
| 197 |
+
hf_token_global = gr.Textbox(
|
| 198 |
+
label="HuggingFace Token (Required)",
|
| 199 |
+
placeholder="Enter your HF token from https://huggingface.co/settings/tokens",
|
| 200 |
+
type="password"
|
| 201 |
+
)
|
| 202 |
+
with gr.Column(scale=2):
|
| 203 |
+
gr.Markdown("""
|
| 204 |
+
**Get a free token:**
|
| 205 |
+
1. Visit [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens)
|
| 206 |
+
2. Click "New token"
|
| 207 |
+
3. Select "Read" permission
|
| 208 |
+
4. Copy and paste it here
|
| 209 |
+
""")
|
| 210 |
+
|
| 211 |
+
with gr.Row():
|
| 212 |
+
submit_token_btn = gr.Button("Submit Token", variant="primary")
|
| 213 |
+
token_status = gr.Markdown("", elem_classes="token-status")
|
| 214 |
+
|
| 215 |
+
def validate_token(token):
|
| 216 |
+
if token and token.strip():
|
| 217 |
+
return '<div class="token-accepted">✅ Token Accepted</div>'
|
| 218 |
+
else:
|
| 219 |
+
return '<div style="background-color: #fee2e2; color: #991b1b; padding: 10px; border-radius: 5px;">❌ Please enter a valid token</div>'
|
| 220 |
+
|
| 221 |
+
submit_token_btn.click(
|
| 222 |
+
fn=validate_token,
|
| 223 |
+
inputs=[hf_token_global],
|
| 224 |
+
outputs=[token_status]
|
| 225 |
+
)
|
| 226 |
+
|
| 227 |
# Main tabs
|
| 228 |
with gr.Tabs():
|
| 229 |
# Chat tab
|
| 230 |
with gr.Tab("💬 Chat"):
|
| 231 |
gr.Markdown("### Ask questions about your projects")
|
| 232 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
# Project selection dropdown
|
| 234 |
project_dropdown = gr.Dropdown(
|
| 235 |
label="Select Project",
|
|
|
|
| 291 |
|
| 292 |
submit_btn.click(
|
| 293 |
fn=respond,
|
| 294 |
+
inputs=[msg, chatbot, project_dropdown, hf_token_global],
|
| 295 |
outputs=[chatbot, msg]
|
| 296 |
)
|
| 297 |
|
| 298 |
msg.submit(
|
| 299 |
fn=respond,
|
| 300 |
+
inputs=[msg, chatbot, project_dropdown, hf_token_global],
|
| 301 |
outputs=[chatbot, msg]
|
| 302 |
)
|
| 303 |
|
|
|
|
| 307 |
with gr.Tab("📤 Upload Meeting"):
|
| 308 |
gr.Markdown("### Upload plain text meeting notes and let AI structure them")
|
| 309 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 310 |
# Project selection with toggle
|
| 311 |
with gr.Row():
|
| 312 |
with gr.Column():
|
|
|
|
| 378 |
|
| 379 |
structure_btn.click(
|
| 380 |
fn=structure_meeting_wrapper,
|
| 381 |
+
inputs=[project_mode, existing_project, new_project, upload_title, upload_date, upload_participants, upload_text, hf_token_global],
|
| 382 |
outputs=structure_output
|
| 383 |
)
|
| 384 |
|