Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -64,42 +64,46 @@ def respond(message, history):
|
|
| 64 |
|
| 65 |
# 3. Interfaccia Chat
|
| 66 |
|
| 67 |
-
# Definiamo il CSS
|
| 68 |
custom_css = """
|
| 69 |
#bordo-scuro {
|
| 70 |
-
border:
|
| 71 |
border-radius: 8px !important;
|
| 72 |
}
|
| 73 |
-
|
| 74 |
background-color: #ffffff !important;
|
| 75 |
}
|
| 76 |
"""
|
| 77 |
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
]
|
| 86 |
-
)
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
placeholder="π Scrivi qui la tua domanda e premi INVIO...",
|
| 91 |
-
container=False,
|
| 92 |
-
scale=7
|
| 93 |
-
),
|
| 94 |
-
css=custom_css, # <--- Inseriamo il blocco grafico qui
|
| 95 |
-
title="π Limba 1.0 - Progetto Margherita",
|
| 96 |
-
description="Assistente creato dagli studenti del Liceo Scientifico 'E. Fermi' - Nuoro e dal docente di intelligenza artificiale Francesco Palladino.",
|
| 97 |
-
examples=[
|
| 98 |
-
"Chie ti hat creadu?",
|
| 99 |
-
"Spiegami la seconda legge di Newton",
|
| 100 |
-
"Spiegami la fotosintesi clorofilliana"
|
| 101 |
-
]
|
| 102 |
-
)
|
| 103 |
|
| 104 |
if __name__ == "__main__":
|
| 105 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
| 64 |
|
| 65 |
# 3. Interfaccia Chat
|
| 66 |
|
| 67 |
+
# Definiamo il CSS per il bordo scuro
|
| 68 |
custom_css = """
|
| 69 |
#bordo-scuro {
|
| 70 |
+
border: 2px solid #000000 !important;
|
| 71 |
border-radius: 8px !important;
|
| 72 |
}
|
| 73 |
+
textarea {
|
| 74 |
background-color: #ffffff !important;
|
| 75 |
}
|
| 76 |
"""
|
| 77 |
|
| 78 |
+
# Usiamo gr.Blocks come contenitore principale per iniettare il CSS
|
| 79 |
+
with gr.Blocks(css=custom_css) as demo:
|
| 80 |
+
gr.ChatInterface(
|
| 81 |
+
respond,
|
| 82 |
+
# 1. Configurazione del Chatbot (Supporto LaTeX per le formule)
|
| 83 |
+
chatbot=gr.Chatbot(
|
| 84 |
+
latex_delimiters=[
|
| 85 |
+
{"left": "$$", "right": "$$", "display": True},
|
| 86 |
+
{"left": "$", "right": "$", "display": False}
|
| 87 |
+
]
|
| 88 |
+
),
|
| 89 |
+
# 2. Riquadro di testo collegato al nostro CSS
|
| 90 |
+
textbox=gr.Textbox(
|
| 91 |
+
elem_id="bordo-scuro",
|
| 92 |
+
placeholder="π Scrivi qui la tua domanda e premi INVIO...",
|
| 93 |
+
container=False,
|
| 94 |
+
scale=7
|
| 95 |
+
),
|
| 96 |
+
title="π Limba 1.0 - Progetto Margherita",
|
| 97 |
+
description="Liceo Scientifico 'E. Fermi' - Nuoro. Assistente creato da Francesco Palladino.",
|
| 98 |
+
examples=[
|
| 99 |
+
"Chie ti hat creadu?",
|
| 100 |
+
"Spiegami la seconda legge di Newton",
|
| 101 |
+
"Spiegami la fotosintesi clorofilliana"
|
| 102 |
]
|
| 103 |
+
)
|
| 104 |
+
|
| 105 |
+
if __name__ == "__main__":
|
| 106 |
+
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
|
| 108 |
if __name__ == "__main__":
|
| 109 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|