Update app.py
Browse files
app.py
CHANGED
@@ -46,12 +46,20 @@ CSS = """
|
|
46 |
margin: 5px 0;
|
47 |
}
|
48 |
.thinking-container {
|
49 |
-
border-left: 3px solid #
|
50 |
padding-left: 10px;
|
51 |
margin: 8px 0;
|
|
|
52 |
}
|
53 |
details:not([open]) .thinking-container {
|
54 |
-
border-left-color: #
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
}
|
56 |
"""
|
57 |
|
@@ -104,6 +112,7 @@ def parse_response(text, state):
|
|
104 |
def format_response(state, elapsed):
|
105 |
answer_part = state.answer.replace('<think>', '').replace('</think>', '')
|
106 |
collapsible = []
|
|
|
107 |
|
108 |
if state.thought or state.in_think:
|
109 |
if state.in_think:
|
@@ -115,8 +124,9 @@ def format_response(state, elapsed):
|
|
115 |
# Finished: show total accumulated time
|
116 |
formatted_time = format_time(state.total_think_time)
|
117 |
status = f"✅ Thought for {formatted_time}"
|
|
|
118 |
collapsible.append(
|
119 |
-
f"<
|
120 |
)
|
121 |
|
122 |
return collapsible, answer_part
|
@@ -195,7 +205,7 @@ with gr.Blocks(css=CSS) as demo:
|
|
195 |
examples=[
|
196 |
["How many r's are in the word strawberry?"],
|
197 |
["Write 10 funny sentences that end in a fruit!"],
|
198 |
-
["Let
|
199 |
],
|
200 |
inputs=msg,
|
201 |
label="Example Prompts"
|
|
|
46 |
margin: 5px 0;
|
47 |
}
|
48 |
.thinking-container {
|
49 |
+
border-left: 3px solid #facc15;
|
50 |
padding-left: 10px;
|
51 |
margin: 8px 0;
|
52 |
+
background: #210c29;
|
53 |
}
|
54 |
details:not([open]) .thinking-container {
|
55 |
+
border-left-color: #290c15;
|
56 |
+
}
|
57 |
+
details {
|
58 |
+
border: 1px solid #e0e0e0 !important;
|
59 |
+
border-radius: 8px !important;
|
60 |
+
padding: 12px !important;
|
61 |
+
margin: 8px 0 !important;
|
62 |
+
transition: border-color 0.2s;
|
63 |
}
|
64 |
"""
|
65 |
|
|
|
112 |
def format_response(state, elapsed):
|
113 |
answer_part = state.answer.replace('<think>', '').replace('</think>', '')
|
114 |
collapsible = []
|
115 |
+
collapsed = "<details open>"
|
116 |
|
117 |
if state.thought or state.in_think:
|
118 |
if state.in_think:
|
|
|
124 |
# Finished: show total accumulated time
|
125 |
formatted_time = format_time(state.total_think_time)
|
126 |
status = f"✅ Thought for {formatted_time}"
|
127 |
+
collapsed = "<details>"
|
128 |
collapsible.append(
|
129 |
+
f"{collapsed}<summary>{status}</summary>\n\n<div class='thinking-container'>\n{state.thought}\n</div>\n</details>"
|
130 |
)
|
131 |
|
132 |
return collapsible, answer_part
|
|
|
205 |
examples=[
|
206 |
["How many r's are in the word strawberry?"],
|
207 |
["Write 10 funny sentences that end in a fruit!"],
|
208 |
+
["Let’s play word chains! I’ll start: PIZZA. Your turn! Next word must start with… A!"]
|
209 |
],
|
210 |
inputs=msg,
|
211 |
label="Example Prompts"
|