Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,7 @@ client = InferenceClient("lambdaindie/lambdai")
|
|
6 |
|
7 |
css = """
|
8 |
body {
|
9 |
-
background-color: #
|
10 |
color: #e0e0e0;
|
11 |
font-family: 'JetBrains Mono', monospace;
|
12 |
}
|
@@ -31,35 +31,24 @@ body {
|
|
31 |
font-family: 'JetBrains Mono', monospace;
|
32 |
}
|
33 |
.markdown-think {
|
34 |
-
background-color: #
|
35 |
border-left: 4px solid #555;
|
36 |
padding: 10px;
|
37 |
-
margin: 8px
|
38 |
font-style: italic;
|
39 |
white-space: pre-wrap;
|
40 |
font-family: 'JetBrains Mono', monospace;
|
41 |
-
display: flex;
|
42 |
-
align-items: center;
|
43 |
-
gap: 10px;
|
44 |
animation: pulse 1.5s infinite ease-in-out;
|
45 |
-
overflow-wrap: anywhere;
|
46 |
-
}
|
47 |
-
.loader {
|
48 |
-
width: 14px;
|
49 |
-
height: 14px;
|
50 |
-
border: 2px solid #888;
|
51 |
-
border-top: 2px solid #e0e0e0;
|
52 |
-
border-radius: 50%;
|
53 |
-
animation: spin 1s linear infinite;
|
54 |
-
}
|
55 |
-
@keyframes spin {
|
56 |
-
to { transform: rotate(360deg); }
|
57 |
}
|
58 |
@keyframes pulse {
|
59 |
0% { opacity: 0.6; }
|
60 |
50% { opacity: 1.0; }
|
61 |
100% { opacity: 0.6; }
|
62 |
}
|
|
|
|
|
|
|
|
|
63 |
"""
|
64 |
|
65 |
def respond(message, history, system_message, max_tokens, temperature, top_p):
|
@@ -79,7 +68,7 @@ def respond(message, history, system_message, max_tokens, temperature, top_p):
|
|
79 |
]
|
80 |
|
81 |
reasoning = ""
|
82 |
-
yield '<div class="markdown-think"
|
83 |
|
84 |
for chunk in client.chat_completion(
|
85 |
thinking_prompt,
|
@@ -90,7 +79,7 @@ def respond(message, history, system_message, max_tokens, temperature, top_p):
|
|
90 |
):
|
91 |
token = chunk.choices[0].delta.content or ""
|
92 |
reasoning += token
|
93 |
-
styled_thought = f'<div class="markdown-think"
|
94 |
yield styled_thought
|
95 |
|
96 |
time.sleep(0.5)
|
@@ -115,7 +104,7 @@ def respond(message, history, system_message, max_tokens, temperature, top_p):
|
|
115 |
|
116 |
demo = gr.ChatInterface(
|
117 |
fn=respond,
|
118 |
-
title
|
119 |
theme=gr.themes.Base(primary_hue="gray"),
|
120 |
css=css,
|
121 |
additional_inputs=[
|
|
|
6 |
|
7 |
css = """
|
8 |
body {
|
9 |
+
background-color: #111;
|
10 |
color: #e0e0e0;
|
11 |
font-family: 'JetBrains Mono', monospace;
|
12 |
}
|
|
|
31 |
font-family: 'JetBrains Mono', monospace;
|
32 |
}
|
33 |
.markdown-think {
|
34 |
+
background-color: #1e1e1e;
|
35 |
border-left: 4px solid #555;
|
36 |
padding: 10px;
|
37 |
+
margin-bottom: 8px;
|
38 |
font-style: italic;
|
39 |
white-space: pre-wrap;
|
40 |
font-family: 'JetBrains Mono', monospace;
|
|
|
|
|
|
|
41 |
animation: pulse 1.5s infinite ease-in-out;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
}
|
43 |
@keyframes pulse {
|
44 |
0% { opacity: 0.6; }
|
45 |
50% { opacity: 1.0; }
|
46 |
100% { opacity: 0.6; }
|
47 |
}
|
48 |
+
.gr-chatbot {
|
49 |
+
width: 100% !important;
|
50 |
+
max-width: 100% !important;
|
51 |
+
}
|
52 |
"""
|
53 |
|
54 |
def respond(message, history, system_message, max_tokens, temperature, top_p):
|
|
|
68 |
]
|
69 |
|
70 |
reasoning = ""
|
71 |
+
yield '<div class="markdown-think">Thinking...</div>'
|
72 |
|
73 |
for chunk in client.chat_completion(
|
74 |
thinking_prompt,
|
|
|
79 |
):
|
80 |
token = chunk.choices[0].delta.content or ""
|
81 |
reasoning += token
|
82 |
+
styled_thought = f'<div class="markdown-think">{reasoning.strip()}</div>'
|
83 |
yield styled_thought
|
84 |
|
85 |
time.sleep(0.5)
|
|
|
104 |
|
105 |
demo = gr.ChatInterface(
|
106 |
fn=respond,
|
107 |
+
title=位ambdAI,
|
108 |
theme=gr.themes.Base(primary_hue="gray"),
|
109 |
css=css,
|
110 |
additional_inputs=[
|