Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -7,32 +7,49 @@ client = InferenceClient("lambdaindie/lambdai")
|
|
7 |
css = """
|
8 |
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono&display=swap');
|
9 |
|
10 |
-
{
|
11 |
-
font-family: 'JetBrains Mono', monospace !important;
|
12 |
}
|
13 |
|
14 |
-
body {
|
15 |
-
|
16 |
-
color: #
|
|
|
17 |
}
|
18 |
|
19 |
.markdown-think {
|
20 |
-
background-color: #1e1e1e;
|
21 |
-
border-left: 4px solid #555;
|
22 |
-
padding: 10px;
|
23 |
-
margin-bottom: 8px;
|
24 |
-
font-style: italic;
|
25 |
-
white-space: pre-wrap;
|
26 |
-
animation: pulse 1.5s infinite ease-in-out;
|
27 |
}
|
28 |
|
29 |
@keyframes pulse {
|
30 |
-
0% { opacity: 0.6; }
|
31 |
-
50% { opacity: 1.0; }
|
32 |
-
100% { opacity: 0.6; }
|
33 |
}
|
34 |
"""
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
def respond(message, history, system_message, max_tokens, temperature, top_p):
|
37 |
messages = [{"role": "system", "content": system_message}] if system_message else []
|
38 |
|
@@ -68,8 +85,8 @@ def respond(message, history, system_message, max_tokens, temperature, top_p):
|
|
68 |
|
69 |
yield f"""
|
70 |
<div style="margin-top:12px;padding:8px 12px;background-color:#222;border-left:4px solid #888;
|
71 |
-
|
72 |
-
|
73 |
</div>
|
74 |
"""
|
75 |
|
@@ -96,7 +113,7 @@ def respond(message, history, system_message, max_tokens, temperature, top_p):
|
|
96 |
demo = gr.ChatInterface(
|
97 |
fn=respond,
|
98 |
title="位ambdAI",
|
99 |
-
theme=
|
100 |
css=css,
|
101 |
additional_inputs=[
|
102 |
gr.Textbox(value="", label="System Message"),
|
|
|
7 |
css = """
|
8 |
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono&display=swap');
|
9 |
|
10 |
+
* {
|
11 |
+
font-family: 'JetBrains Mono', monospace !important;
|
12 |
}
|
13 |
|
14 |
+
html, body, input, button, textarea, select, .gradio-container {
|
15 |
+
font-family: 'JetBrains Mono', monospace !important;
|
16 |
+
background-color: #111 !important;
|
17 |
+
color: #e0e0e0 !important;
|
18 |
}
|
19 |
|
20 |
.markdown-think {
|
21 |
+
background-color: #1e1e1e;
|
22 |
+
border-left: 4px solid #555;
|
23 |
+
padding: 10px;
|
24 |
+
margin-bottom: 8px;
|
25 |
+
font-style: italic;
|
26 |
+
white-space: pre-wrap;
|
27 |
+
animation: pulse 1.5s infinite ease-in-out;
|
28 |
}
|
29 |
|
30 |
@keyframes pulse {
|
31 |
+
0% { opacity: 0.6; }
|
32 |
+
50% { opacity: 1.0; }
|
33 |
+
100% { opacity: 0.6; }
|
34 |
}
|
35 |
"""
|
36 |
|
37 |
+
theme = gr.themes.Base(
|
38 |
+
primary_hue="gray",
|
39 |
+
font=[
|
40 |
+
gr.themes.GoogleFont("JetBrains Mono"),
|
41 |
+
"monospace"
|
42 |
+
]
|
43 |
+
).set(
|
44 |
+
body_background_fill="#111",
|
45 |
+
body_text_color="#e0e0e0",
|
46 |
+
button_primary_background_fill="#333",
|
47 |
+
button_primary_text_color="#e0e0e0",
|
48 |
+
input_background_fill="#222",
|
49 |
+
input_border_color="#444",
|
50 |
+
block_title_text_color="#fff"
|
51 |
+
)
|
52 |
+
|
53 |
def respond(message, history, system_message, max_tokens, temperature, top_p):
|
54 |
messages = [{"role": "system", "content": system_message}] if system_message else []
|
55 |
|
|
|
85 |
|
86 |
yield f"""
|
87 |
<div style="margin-top:12px;padding:8px 12px;background-color:#222;border-left:4px solid #888;
|
88 |
+
font-family:'JetBrains Mono', monospace;color:#ccc;font-size:14px;">
|
89 |
+
Pensou por {elapsed:.1f} segundos
|
90 |
</div>
|
91 |
"""
|
92 |
|
|
|
113 |
demo = gr.ChatInterface(
|
114 |
fn=respond,
|
115 |
title="位ambdAI",
|
116 |
+
theme=theme,
|
117 |
css=css,
|
118 |
additional_inputs=[
|
119 |
gr.Textbox(value="", label="System Message"),
|