Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -157,21 +157,21 @@ p {
|
|
| 157 |
color: #5F6F65 !important;
|
| 158 |
}
|
| 159 |
|
| 160 |
-
.chat-message {
|
| 161 |
border-radius: 10px;
|
| 162 |
padding: 10px;
|
| 163 |
margin-bottom: 10px;
|
| 164 |
}
|
| 165 |
|
| 166 |
-
.chat-message.user {
|
| 167 |
background-color: #E7F0DC;
|
| 168 |
}
|
| 169 |
|
| 170 |
-
.chat-message.bot {
|
| 171 |
background-color: #F7EED3;
|
| 172 |
}
|
| 173 |
|
| 174 |
-
.chat-message::before {
|
| 175 |
content: '';
|
| 176 |
display: inline-block;
|
| 177 |
width: 24px;
|
|
@@ -182,16 +182,16 @@ p {
|
|
| 182 |
vertical-align: middle;
|
| 183 |
}
|
| 184 |
|
| 185 |
-
.chat-message.user::before {
|
| 186 |
content: '👤';
|
| 187 |
}
|
| 188 |
|
| 189 |
-
.chat-message.bot::before {
|
| 190 |
content: '🤖';
|
| 191 |
}
|
| 192 |
label {
|
| 193 |
-
font-size:
|
| 194 |
-
color:
|
| 195 |
}
|
| 196 |
#pdf_input, #submit_button_pdf, #chat_input, #chat_output, #audio_output {
|
| 197 |
text-align: right; /* Ensure RTL alignment */
|
|
@@ -246,7 +246,7 @@ with gr.Blocks(css=custom_css) as demo:
|
|
| 246 |
submit_button_chat = gr.Button("إرسال", interactive=False)
|
| 247 |
|
| 248 |
def handle_file_upload(pdf):
|
| 249 |
-
output_label.value
|
| 250 |
message, is_valid = validate_pdf(pdf)
|
| 251 |
color = "red" if not is_valid else "green"
|
| 252 |
# Update HTML label instead of Textbox
|
|
@@ -254,15 +254,15 @@ with gr.Blocks(css=custom_css) as demo:
|
|
| 254 |
if is_valid:
|
| 255 |
# Enable the upload button if the file is valid
|
| 256 |
submit_button_pdf.update(interactive=True)
|
| 257 |
-
output_label.value
|
| 258 |
else:
|
| 259 |
-
output_label.value
|
| 260 |
|
| 261 |
def process_pdf_and_enable_components(pdf):
|
| 262 |
# Process PDF and activate the other components
|
| 263 |
-
output_label.value
|
| 264 |
message, is_valid = upload_pdf(pdf)
|
| 265 |
-
output_label.value
|
| 266 |
if is_valid:
|
| 267 |
chat_input.update(interactive=True)
|
| 268 |
chat_output.update(interactive=True)
|
|
|
|
| 157 |
color: #5F6F65 !important;
|
| 158 |
}
|
| 159 |
|
| 160 |
+
.gradio-chat-message {
|
| 161 |
border-radius: 10px;
|
| 162 |
padding: 10px;
|
| 163 |
margin-bottom: 10px;
|
| 164 |
}
|
| 165 |
|
| 166 |
+
.gradio.chat-message.user {
|
| 167 |
background-color: #E7F0DC;
|
| 168 |
}
|
| 169 |
|
| 170 |
+
.gradio.chat-message.bot {
|
| 171 |
background-color: #F7EED3;
|
| 172 |
}
|
| 173 |
|
| 174 |
+
.gradio-chat-message::before {
|
| 175 |
content: '';
|
| 176 |
display: inline-block;
|
| 177 |
width: 24px;
|
|
|
|
| 182 |
vertical-align: middle;
|
| 183 |
}
|
| 184 |
|
| 185 |
+
.gradio-chat-message.user::before {
|
| 186 |
content: '👤';
|
| 187 |
}
|
| 188 |
|
| 189 |
+
.gradio-chat-message.bot::before {
|
| 190 |
content: '🤖';
|
| 191 |
}
|
| 192 |
label {
|
| 193 |
+
font-size: 16px; /* Label customizations */
|
| 194 |
+
color: blue; /* Change color as needed */
|
| 195 |
}
|
| 196 |
#pdf_input, #submit_button_pdf, #chat_input, #chat_output, #audio_output {
|
| 197 |
text-align: right; /* Ensure RTL alignment */
|
|
|
|
| 246 |
submit_button_chat = gr.Button("إرسال", interactive=False)
|
| 247 |
|
| 248 |
def handle_file_upload(pdf):
|
| 249 |
+
output_label.value=''
|
| 250 |
message, is_valid = validate_pdf(pdf)
|
| 251 |
color = "red" if not is_valid else "green"
|
| 252 |
# Update HTML label instead of Textbox
|
|
|
|
| 254 |
if is_valid:
|
| 255 |
# Enable the upload button if the file is valid
|
| 256 |
submit_button_pdf.update(interactive=True)
|
| 257 |
+
output_label.value=''
|
| 258 |
else:
|
| 259 |
+
output_label.value=f'<span style="color:{color}">{message}</span>'
|
| 260 |
|
| 261 |
def process_pdf_and_enable_components(pdf):
|
| 262 |
# Process PDF and activate the other components
|
| 263 |
+
output_label.value='<span style="color:green">جاري معالجة الملف...</span>'
|
| 264 |
message, is_valid = upload_pdf(pdf)
|
| 265 |
+
output_label.value=f'<span style="color:green">{message}</span>'
|
| 266 |
if is_valid:
|
| 267 |
chat_input.update(interactive=True)
|
| 268 |
chat_output.update(interactive=True)
|