Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -19,7 +19,7 @@ DESCRIPTION = """\
|
|
19 |
# Lexora 3B ITA ๐ฌ ๐ฎ๐น
|
20 |
"""
|
21 |
|
22 |
-
# Updated CSS to ensure full height and proper
|
23 |
CUSTOM_CSS = """
|
24 |
.gradio-container {
|
25 |
height: 100vh !important;
|
@@ -27,55 +27,108 @@ CUSTOM_CSS = """
|
|
27 |
padding: 0 !important;
|
28 |
background-color: #0f1117;
|
29 |
}
|
30 |
-
|
31 |
.contain {
|
32 |
height: 100vh !important;
|
33 |
max-height: 100vh !important;
|
34 |
display: flex;
|
35 |
flex-direction: column;
|
36 |
}
|
37 |
-
|
38 |
.main-container {
|
39 |
flex-grow: 1;
|
40 |
height: calc(100vh - 100px) !important;
|
41 |
overflow: hidden !important;
|
42 |
}
|
43 |
-
|
44 |
.chat-container {
|
45 |
height: 100% !important;
|
46 |
overflow: hidden !important;
|
47 |
display: flex;
|
48 |
flex-direction: column;
|
49 |
}
|
50 |
-
|
51 |
.chat-messages {
|
52 |
flex-grow: 1;
|
53 |
overflow-y: auto !important;
|
54 |
padding: 1rem;
|
55 |
}
|
56 |
-
|
57 |
.message-wrap {
|
58 |
height: auto !important;
|
59 |
max-height: none !important;
|
60 |
}
|
61 |
-
|
62 |
.message {
|
63 |
padding: 1rem !important;
|
64 |
margin: 0.5rem 0 !important;
|
65 |
border-radius: 0.5rem !important;
|
66 |
}
|
67 |
-
|
68 |
.user-message {
|
69 |
background-color: #2b2d31 !important;
|
70 |
}
|
71 |
-
|
72 |
.bot-message {
|
73 |
background-color: #1e1f23 !important;
|
74 |
}
|
75 |
-
|
76 |
.examples-container {
|
77 |
margin-top: auto;
|
78 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
"""
|
80 |
|
81 |
MAX_MAX_NEW_TOKENS = 2048
|
@@ -192,8 +245,11 @@ chat_interface = gr.ChatInterface(
|
|
192 |
stop_btn=None,
|
193 |
examples=[
|
194 |
["Ciao! Come stai?"],
|
|
|
|
|
195 |
],
|
196 |
cache_examples=False,
|
|
|
197 |
)
|
198 |
|
199 |
with gr.Blocks(css=CUSTOM_CSS, fill_height=True, theme=gr.themes.Base()) as demo:
|
|
|
19 |
# Lexora 3B ITA ๐ฌ ๐ฎ๐น
|
20 |
"""
|
21 |
|
22 |
+
# Updated CSS to ensure full height and proper markdown rendering
|
23 |
CUSTOM_CSS = """
|
24 |
.gradio-container {
|
25 |
height: 100vh !important;
|
|
|
27 |
padding: 0 !important;
|
28 |
background-color: #0f1117;
|
29 |
}
|
|
|
30 |
.contain {
|
31 |
height: 100vh !important;
|
32 |
max-height: 100vh !important;
|
33 |
display: flex;
|
34 |
flex-direction: column;
|
35 |
}
|
|
|
36 |
.main-container {
|
37 |
flex-grow: 1;
|
38 |
height: calc(100vh - 100px) !important;
|
39 |
overflow: hidden !important;
|
40 |
}
|
|
|
41 |
.chat-container {
|
42 |
height: 100% !important;
|
43 |
overflow: hidden !important;
|
44 |
display: flex;
|
45 |
flex-direction: column;
|
46 |
}
|
|
|
47 |
.chat-messages {
|
48 |
flex-grow: 1;
|
49 |
overflow-y: auto !important;
|
50 |
padding: 1rem;
|
51 |
}
|
|
|
52 |
.message-wrap {
|
53 |
height: auto !important;
|
54 |
max-height: none !important;
|
55 |
}
|
|
|
56 |
.message {
|
57 |
padding: 1rem !important;
|
58 |
margin: 0.5rem 0 !important;
|
59 |
border-radius: 0.5rem !important;
|
60 |
}
|
|
|
61 |
.user-message {
|
62 |
background-color: #2b2d31 !important;
|
63 |
}
|
|
|
64 |
.bot-message {
|
65 |
background-color: #1e1f23 !important;
|
66 |
}
|
|
|
67 |
.examples-container {
|
68 |
margin-top: auto;
|
69 |
}
|
70 |
+
/* Markdown styling */
|
71 |
+
.bot-message p {
|
72 |
+
margin-bottom: 0.5rem;
|
73 |
+
}
|
74 |
+
.bot-message h1, .bot-message h2, .bot-message h3,
|
75 |
+
.bot-message h4, .bot-message h5, .bot-message h6 {
|
76 |
+
margin-top: 1rem;
|
77 |
+
margin-bottom: 0.5rem;
|
78 |
+
}
|
79 |
+
.bot-message code {
|
80 |
+
background-color: #2d2d2d;
|
81 |
+
padding: 0.2rem 0.4rem;
|
82 |
+
border-radius: 0.2rem;
|
83 |
+
font-family: monospace;
|
84 |
+
}
|
85 |
+
.bot-message pre {
|
86 |
+
background-color: #2d2d2d;
|
87 |
+
padding: 1rem;
|
88 |
+
border-radius: 0.5rem;
|
89 |
+
overflow-x: auto;
|
90 |
+
margin: 1rem 0;
|
91 |
+
}
|
92 |
+
.bot-message pre code {
|
93 |
+
background-color: transparent;
|
94 |
+
padding: 0;
|
95 |
+
border-radius: 0;
|
96 |
+
}
|
97 |
+
.bot-message ul, .bot-message ol {
|
98 |
+
padding-left: 1.5rem;
|
99 |
+
margin-bottom: 0.5rem;
|
100 |
+
}
|
101 |
+
.bot-message blockquote {
|
102 |
+
border-left: 3px solid #4a4a4a;
|
103 |
+
padding-left: 1rem;
|
104 |
+
margin: 0.5rem 0;
|
105 |
+
color: #a0a0a0;
|
106 |
+
}
|
107 |
+
.bot-message table {
|
108 |
+
border-collapse: collapse;
|
109 |
+
width: 100%;
|
110 |
+
margin: 1rem 0;
|
111 |
+
}
|
112 |
+
.bot-message th, .bot-message td {
|
113 |
+
border: 1px solid #4a4a4a;
|
114 |
+
padding: 0.5rem;
|
115 |
+
text-align: left;
|
116 |
+
}
|
117 |
+
.bot-message th {
|
118 |
+
background-color: #2a2a2a;
|
119 |
+
}
|
120 |
+
.bot-message img {
|
121 |
+
max-width: 100%;
|
122 |
+
height: auto;
|
123 |
+
margin: 1rem 0;
|
124 |
+
}
|
125 |
+
.bot-message a {
|
126 |
+
color: #3291ff;
|
127 |
+
text-decoration: none;
|
128 |
+
}
|
129 |
+
.bot-message a:hover {
|
130 |
+
text-decoration: underline;
|
131 |
+
}
|
132 |
"""
|
133 |
|
134 |
MAX_MAX_NEW_TOKENS = 2048
|
|
|
245 |
stop_btn=None,
|
246 |
examples=[
|
247 |
["Ciao! Come stai?"],
|
248 |
+
["Puoi scrivere una lista markdown?"],
|
249 |
+
["Scrivi un esempio di codice Python"],
|
250 |
],
|
251 |
cache_examples=False,
|
252 |
+
render_markdown=True, # Enable Markdown rendering
|
253 |
)
|
254 |
|
255 |
with gr.Blocks(css=CUSTOM_CSS, fill_height=True, theme=gr.themes.Base()) as demo:
|