Spaces:
Sleeping
Sleeping
bordi
Browse files
app.py
CHANGED
|
@@ -63,25 +63,38 @@ def respond(message, history):
|
|
| 63 |
return response["choices"][0]["text"].strip()
|
| 64 |
|
| 65 |
# 3. Interfaccia Chat
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
demo = gr.ChatInterface(
|
| 67 |
respond,
|
| 68 |
-
# 1. Configurazione del Chatbot (Supporto
|
| 69 |
chatbot=gr.Chatbot(
|
| 70 |
latex_delimiters=[
|
| 71 |
{"left": "$$", "right": "$$", "display": True},
|
| 72 |
{"left": "$", "right": "$", "display": False}
|
| 73 |
]
|
| 74 |
),
|
| 75 |
-
# 2. Riquadro di testo
|
| 76 |
textbox=gr.Textbox(
|
| 77 |
-
placeholder="Scrivi qui la tua domanda
|
| 78 |
container=False,
|
| 79 |
-
scale=7
|
| 80 |
-
lines=2
|
| 81 |
),
|
| 82 |
-
# 3. Testi e
|
| 83 |
title="🚀 Limba 1.0 - Progetto Margherita",
|
| 84 |
-
description=
|
| 85 |
examples=[
|
| 86 |
"Chie ti hat creadu?",
|
| 87 |
"Spiegami la seconda legge di Newton",
|
|
@@ -95,5 +108,8 @@ if __name__ == "__main__":
|
|
| 95 |
if __name__ == "__main__":
|
| 96 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|
| 97 |
|
|
|
|
|
|
|
|
|
|
| 98 |
if __name__ == "__main__":
|
| 99 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
| 63 |
return response["choices"][0]["text"].strip()
|
| 64 |
|
| 65 |
# 3. Interfaccia Chat
|
| 66 |
+
|
| 67 |
+
# Trucco CSS per scurire i bordi del riquadro di testo senza far crashare Gradio
|
| 68 |
+
description_html = """
|
| 69 |
+
<style>
|
| 70 |
+
/* Forza un bordo scuro e spesso per il riquadro dove si scrive */
|
| 71 |
+
textarea {
|
| 72 |
+
border: 2px solid #4a4a4a !important;
|
| 73 |
+
border-radius: 8px !important;
|
| 74 |
+
background-color: #ffffff !important;
|
| 75 |
+
}
|
| 76 |
+
</style>
|
| 77 |
+
Liceo Scientifico 'E. Fermi' - Nuoro. Assistente creato da Francesco Palladino.
|
| 78 |
+
"""
|
| 79 |
+
|
| 80 |
demo = 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 con Invio rapido
|
| 90 |
textbox=gr.Textbox(
|
| 91 |
+
placeholder="👉 Scrivi qui la tua domanda e premi INVIO...",
|
| 92 |
container=False,
|
| 93 |
+
scale=7
|
|
|
|
| 94 |
),
|
| 95 |
+
# 3. Testi e stile personalizzato
|
| 96 |
title="🚀 Limba 1.0 - Progetto Margherita",
|
| 97 |
+
description=description_html,
|
| 98 |
examples=[
|
| 99 |
"Chie ti hat creadu?",
|
| 100 |
"Spiegami la seconda legge di Newton",
|
|
|
|
| 108 |
if __name__ == "__main__":
|
| 109 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|
| 110 |
|
| 111 |
+
if __name__ == "__main__":
|
| 112 |
+
demo.launch(server_name="0.0.0.0", server_port=7860)
|
| 113 |
+
|
| 114 |
if __name__ == "__main__":
|
| 115 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|