Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -45,21 +45,34 @@ st.markdown("""
|
|
45 |
.carfind-logo {
|
46 |
animation: bounceIn 0.6s ease-out;
|
47 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
.spec-table {
|
49 |
width: 100%;
|
50 |
border-collapse: collapse;
|
51 |
-
margin-top:
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
}
|
53 |
.spec-table th {
|
54 |
background-color: #0071BC;
|
55 |
color: white;
|
56 |
-
padding: 10px;
|
57 |
-
text-align: left;
|
58 |
}
|
59 |
.spec-table td {
|
60 |
-
|
61 |
-
border: 1px solid #ccc;
|
62 |
-
background-color: #f9f9f9;
|
63 |
}
|
64 |
.icon {
|
65 |
width: 16px;
|
@@ -213,23 +226,23 @@ with tab2:
|
|
213 |
cleaned_message = re.sub(r'\*\*(.*?)\*\*', r'<strong>\1</strong>', assistant_message)
|
214 |
cleaned_message = cleaned_message.replace("###", "<h4 style='margin-bottom: 10px;'>").replace("\n", "<br>")
|
215 |
|
216 |
-
#
|
217 |
-
|
218 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
|
220 |
st.success("✅ Identification Complete")
|
221 |
st.markdown(f"""
|
222 |
-
<div
|
223 |
-
font-family: "Segoe UI", sans-serif;
|
224 |
-
background-color: #ffffff;
|
225 |
-
color: #003B6F;
|
226 |
-
padding: 24px;
|
227 |
-
border-radius: 12px;
|
228 |
-
box-shadow: 0 4px 12px rgba(0,0,0,0.05);
|
229 |
-
border-left: 5px solid #0071BC;
|
230 |
-
font-size: 15.5px;
|
231 |
-
line-height: 1.7;
|
232 |
-
'>
|
233 |
{cleaned_message}
|
234 |
</div>
|
235 |
""", unsafe_allow_html=True)
|
|
|
45 |
.carfind-logo {
|
46 |
animation: bounceIn 0.6s ease-out;
|
47 |
}
|
48 |
+
.car-spec-output {
|
49 |
+
font-family: "Segoe UI", sans-serif;
|
50 |
+
font-size: 14px;
|
51 |
+
background-color: #ffffff;
|
52 |
+
color: #003B6F;
|
53 |
+
padding: 20px;
|
54 |
+
border-radius: 10px;
|
55 |
+
box-shadow: 0 4px 12px rgba(0,0,0,0.05);
|
56 |
+
border-left: 5px solid #0071BC;
|
57 |
+
line-height: 1.6;
|
58 |
+
}
|
59 |
.spec-table {
|
60 |
width: 100%;
|
61 |
border-collapse: collapse;
|
62 |
+
margin-top: 15px;
|
63 |
+
margin-bottom: 20px;
|
64 |
+
}
|
65 |
+
.spec-table th, .spec-table td {
|
66 |
+
border: 1px solid #ddd;
|
67 |
+
padding: 10px 12px;
|
68 |
+
text-align: left;
|
69 |
}
|
70 |
.spec-table th {
|
71 |
background-color: #0071BC;
|
72 |
color: white;
|
|
|
|
|
73 |
}
|
74 |
.spec-table td {
|
75 |
+
background-color: #f7f9fc;
|
|
|
|
|
76 |
}
|
77 |
.icon {
|
78 |
width: 16px;
|
|
|
226 |
cleaned_message = re.sub(r'\*\*(.*?)\*\*', r'<strong>\1</strong>', assistant_message)
|
227 |
cleaned_message = cleaned_message.replace("###", "<h4 style='margin-bottom: 10px;'>").replace("\n", "<br>")
|
228 |
|
229 |
+
# Extract markdown table (if present)
|
230 |
+
if '|' in cleaned_message:
|
231 |
+
lines = cleaned_message.split('<br>')
|
232 |
+
html_table = """<table class='spec-table'>"""
|
233 |
+
for line in lines:
|
234 |
+
if '|' in line:
|
235 |
+
cells = line.strip('|').split('|')
|
236 |
+
row_html = '<tr>' + ''.join(f'<td>{cell.strip()}</td>' for cell in cells) + '</tr>'
|
237 |
+
html_table += row_html
|
238 |
+
else:
|
239 |
+
html_table += f"</table><p>{line}</p><table class='spec-table'>"
|
240 |
+
html_table += "</table>"
|
241 |
+
cleaned_message = html_table
|
242 |
|
243 |
st.success("✅ Identification Complete")
|
244 |
st.markdown(f"""
|
245 |
+
<div class='car-spec-output'>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
246 |
{cleaned_message}
|
247 |
</div>
|
248 |
""", unsafe_allow_html=True)
|