Feedback: hide HF badge (id), tone green to mockup B, vertical Tipo de análisis, add Catalan
Browse files- space_app.py +34 -1
- web/analysis.py +3 -0
- web/ui.py +52 -4
space_app.py
CHANGED
|
@@ -39,6 +39,9 @@ THEME = gr.themes.Soft(
|
|
| 39 |
# exist in this UI are simply inert.
|
| 40 |
CSS = """
|
| 41 |
@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,600;8..60,700&display=swap');
|
|
|
|
|
|
|
|
|
|
| 42 |
.huggingface-space-header,
|
| 43 |
div[class*="space-header"],
|
| 44 |
header.container,
|
|
@@ -48,7 +51,37 @@ div[data-testid="space-header"] {
|
|
| 48 |
footer { display: none !important; }
|
| 49 |
.gradio-container { max-width: 1040px !important; margin: 0 auto; background: #f4f6f1; }
|
| 50 |
body, gradio-app { background: #f4f6f1 !important; }
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
.gradio-container h1 {
|
| 53 |
font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif !important;
|
| 54 |
font-weight: 700 !important; color: #17321f !important; letter-spacing: -0.01em;
|
|
|
|
| 39 |
# exist in this UI are simply inert.
|
| 40 |
CSS = """
|
| 41 |
@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,600;8..60,700&display=swap');
|
| 42 |
+
/* Hide the HF Space chrome. The floating badge is #huggingface-space-header —
|
| 43 |
+
an ID, not a class; the March attempt targeting the class never matched it. */
|
| 44 |
+
#huggingface-space-header,
|
| 45 |
.huggingface-space-header,
|
| 46 |
div[class*="space-header"],
|
| 47 |
header.container,
|
|
|
|
| 51 |
footer { display: none !important; }
|
| 52 |
.gradio-container { max-width: 1040px !important; margin: 0 auto; background: #f4f6f1; }
|
| 53 |
body, gradio-app { background: #f4f6f1 !important; }
|
| 54 |
+
|
| 55 |
+
/* Verde Institucional — muted forest-green accent, quiet labels (close to mockup B) */
|
| 56 |
+
.gradio-container {
|
| 57 |
+
--button-primary-background-fill: #2f6b43;
|
| 58 |
+
--button-primary-background-fill-hover: #27563a;
|
| 59 |
+
--button-primary-border-color: #2f6b43;
|
| 60 |
+
--button-primary-border-color-hover: #27563a;
|
| 61 |
+
--button-primary-text-color: #ffffff;
|
| 62 |
+
--block-label-background-fill: #ffffff;
|
| 63 |
+
--block-label-text-color: #5b6b5e;
|
| 64 |
+
--block-title-text-color: #17321f;
|
| 65 |
+
--checkbox-background-color-selected: #2f6b43;
|
| 66 |
+
--checkbox-border-color-selected: #2f6b43;
|
| 67 |
+
--slider-color: #2f6b43;
|
| 68 |
+
}
|
| 69 |
+
/* selected radio/checkbox option: soft green chip with dark ink, not a solid block */
|
| 70 |
+
.gradio-container label.selected {
|
| 71 |
+
background: #e8f1e6 !important;
|
| 72 |
+
color: #17321f !important;
|
| 73 |
+
}
|
| 74 |
+
/* quiet field labels (mockup B): drop the green chip, muted ink */
|
| 75 |
+
.gradio-container span[data-testid="block-info"] {
|
| 76 |
+
background: transparent !important;
|
| 77 |
+
color: #5b6b5e !important;
|
| 78 |
+
font-weight: 600;
|
| 79 |
+
padding-left: 0 !important;
|
| 80 |
+
}
|
| 81 |
+
/* "Tipus d'anàlisi": one route per row (full-width labels wrap in the flex row) */
|
| 82 |
+
#route-radio label { width: 100% !important; justify-content: flex-start; }
|
| 83 |
+
|
| 84 |
+
/* serif deep-green headings */
|
| 85 |
.gradio-container h1 {
|
| 86 |
font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif !important;
|
| 87 |
font-weight: 700 !important; color: #17321f !important; letter-spacing: -0.01em;
|
web/analysis.py
CHANGED
|
@@ -105,6 +105,9 @@ FALLBACK_MESSAGE = {
|
|
| 105 |
"en": ("We have reached today's capacity for free analyses. Your query is not lost: write "
|
| 106 |
"to connect@railnexus.io and we will handle it, or ask us about our enterprise plan "
|
| 107 |
"with dedicated capacity and priority response."),
|
|
|
|
|
|
|
|
|
|
| 108 |
}
|
| 109 |
_spend = {"date": "", "usd": 0.0}
|
| 110 |
|
|
|
|
| 105 |
"en": ("We have reached today's capacity for free analyses. Your query is not lost: write "
|
| 106 |
"to connect@railnexus.io and we will handle it, or ask us about our enterprise plan "
|
| 107 |
"with dedicated capacity and priority response."),
|
| 108 |
+
"ca": ("Hem assolit la capacitat d'anàlisis gratuïtes d'avui. La seva consulta no s'ha "
|
| 109 |
+
"perdut: escrigui'ns a connect@railnexus.io i l'atendrem, o pregunti'ns pel nostre "
|
| 110 |
+
"pla empresarial amb capacitat dedicada i resposta prioritària."),
|
| 111 |
}
|
| 112 |
_spend = {"date": "", "usd": 0.0}
|
| 113 |
|
web/ui.py
CHANGED
|
@@ -24,7 +24,7 @@ from web import AGENT_VERSION
|
|
| 24 |
from web import analysis, email_delivery, routes
|
| 25 |
|
| 26 |
TITLE = "RailNexus Value — Real Estate & Infrastructure Agent"
|
| 27 |
-
LANGUAGES = ["es", "en"]
|
| 28 |
ROUTES = ["viability", "check", "market"]
|
| 29 |
|
| 30 |
CONSENT_TEXT_EN = (
|
|
@@ -35,6 +35,15 @@ CONSENT_TEXT_EN = (
|
|
| 35 |
"is stored anywhere**: the document is generated in memory, sent to you and discarded."
|
| 36 |
)
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
LABELS: dict[str, dict[str, Any]] = {
|
| 39 |
"es": {
|
| 40 |
"language": "Idioma / Language",
|
|
@@ -114,6 +123,45 @@ LABELS: dict[str, dict[str, Any]] = {
|
|
| 114 |
"validators_section": "VALIDATOR RESULTS (verbatim)",
|
| 115 |
"nothing_stored": "Nothing has been stored.",
|
| 116 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
}
|
| 118 |
|
| 119 |
|
|
@@ -264,11 +312,11 @@ def build_demo():
|
|
| 264 |
es = LABELS["es"]
|
| 265 |
with gr.Blocks(title=TITLE, delete_cache=(300, 600)) as demo:
|
| 266 |
gr.Markdown(f"# {TITLE}")
|
| 267 |
-
language = gr.Radio(choices=[("Español", "es"), ("English", "en")
|
| 268 |
-
label=es["language"])
|
| 269 |
intro = gr.Markdown(es["intro"])
|
| 270 |
route = gr.Radio(choices=[(v, k) for k, v in es["routes"].items()], value="viability",
|
| 271 |
-
label=es["route"])
|
| 272 |
files = gr.File(label=es["files"], file_count="multiple", type="filepath",
|
| 273 |
file_types=analysis.SUPPORTED_EXTENSIONS)
|
| 274 |
request = gr.Textbox(label=es["request"], placeholder=es["request_placeholder"], lines=3)
|
|
|
|
| 24 |
from web import analysis, email_delivery, routes
|
| 25 |
|
| 26 |
TITLE = "RailNexus Value — Real Estate & Infrastructure Agent"
|
| 27 |
+
LANGUAGES = ["es", "en", "ca"]
|
| 28 |
ROUTES = ["viability", "check", "market"]
|
| 29 |
|
| 30 |
CONSENT_TEXT_EN = (
|
|
|
|
| 35 |
"is stored anywhere**: the document is generated in memory, sent to you and discarded."
|
| 36 |
)
|
| 37 |
|
| 38 |
+
CONSENT_TEXT_CA = (
|
| 39 |
+
"**Consentiment.** Aquest enviament per correu és gratuït; a canvi, **l'únic cost és que "
|
| 40 |
+
"el teu nom i el teu correu s'envien a una adreça de RailNexus**, exactament igual que en "
|
| 41 |
+
"un intercanvi normal de correu professional — aquesta és la condició per rebre el "
|
| 42 |
+
"document per correu, i en prémer «Envia» l'acceptes. **No es desa res sobre la teva "
|
| 43 |
+
"anàlisi, la teva consulta ni la teva propietat enlloc**: el document es genera en "
|
| 44 |
+
"memòria, se t'envia i es descarta."
|
| 45 |
+
)
|
| 46 |
+
|
| 47 |
LABELS: dict[str, dict[str, Any]] = {
|
| 48 |
"es": {
|
| 49 |
"language": "Idioma / Language",
|
|
|
|
| 123 |
"validators_section": "VALIDATOR RESULTS (verbatim)",
|
| 124 |
"nothing_stored": "Nothing has been stored.",
|
| 125 |
},
|
| 126 |
+
"ca": {
|
| 127 |
+
"language": "Idioma / Language",
|
| 128 |
+
"intro": "S'utilitzen dades públiques en directe i els documents que pugis; l'anàlisi pot trigar entre 1 i 5 minuts.",
|
| 129 |
+
"route": "Tipus d'anàlisi",
|
| 130 |
+
"routes": {"viability": "Viabilitat — estudi del projecte, DSCR / LTV, riscos",
|
| 131 |
+
"check": "Comprovació — jurisdicció, documentació, previsat (Espanya)",
|
| 132 |
+
"market": "Mercat — Cadastre, sòl i preus (Espanya, en directe)"},
|
| 133 |
+
"files": "Documents del projecte (PDF · DOCX · XLSX · CSV · TXT)",
|
| 134 |
+
"request": "Què necessites?",
|
| 135 |
+
"request_placeholder": "Descriu què necessites — o deixa-ho buit per a l'anàlisi completa del tipus triat.",
|
| 136 |
+
"description": "Propietat (adreça o descripció, indicant el país)",
|
| 137 |
+
"description_placeholder": "Edifici d'oficines a Madrid, Espanya",
|
| 138 |
+
"asset_type": "Tipus d'actiu",
|
| 139 |
+
"project_type": "Tipus de projecte (previsat, Espanya; buit = cap)",
|
| 140 |
+
"colegio": "Col·legi", "mode": "Mode", "cee": "CEE absent",
|
| 141 |
+
"noi": "NOI anual", "debt": "Servei del deute anual", "loan": "Préstec", "value": "Valor de mercat",
|
| 142 |
+
"market_note": "Coordenades **o** adreça completa (província, municipi, via, número).",
|
| 143 |
+
"lat": "Latitud", "lon": "Longitud", "province": "Província", "municipality": "Municipi",
|
| 144 |
+
"street": "Via", "number": "Número", "radius": "Radi (m)",
|
| 145 |
+
"run": "Executa l'anàlisi", "report": "Informe",
|
| 146 |
+
"email_header": "---\n## Rebre aquest document per correu",
|
| 147 |
+
"consent": CONSENT_TEXT_CA,
|
| 148 |
+
"name": "Nom", "email": "Correu electrònic",
|
| 149 |
+
"accept": "He llegit i accepto el que s'ha exposat", "send": "Envia",
|
| 150 |
+
"delivery_unavailable": "L'enviament per correu no està disponible en aquest moment; pots copiar l'informe directament.",
|
| 151 |
+
"running": "⏳ Executant els validadors…",
|
| 152 |
+
"writing": "✍️ Redactant l'informe…",
|
| 153 |
+
"done": "✅ Anàlisi completada",
|
| 154 |
+
"degraded": "⚠️ Estat degradat",
|
| 155 |
+
"validator_status": "estat del validador",
|
| 156 |
+
"no_ai": "L'anàlisi dels documents no està disponible en aquest moment; només es mostra el resultat dels validadors.",
|
| 157 |
+
"no_docs": "Sense documents ni petició: es mostra el resultat dels validadors.",
|
| 158 |
+
"docs_problem": "Document(s) no llegible(s)",
|
| 159 |
+
"truncated": "document(s) retallat(s) per mida",
|
| 160 |
+
"ai_failed": "❌ No s'ha pogut generar l'informe",
|
| 161 |
+
"error": "❌ Error",
|
| 162 |
+
"validators_section": "RESULTAT DELS VALIDADORS (literal)",
|
| 163 |
+
"nothing_stored": "No s'ha desat res.",
|
| 164 |
+
},
|
| 165 |
}
|
| 166 |
|
| 167 |
|
|
|
|
| 312 |
es = LABELS["es"]
|
| 313 |
with gr.Blocks(title=TITLE, delete_cache=(300, 600)) as demo:
|
| 314 |
gr.Markdown(f"# {TITLE}")
|
| 315 |
+
language = gr.Radio(choices=[("Español", "es"), ("English", "en"), ("Català", "ca")],
|
| 316 |
+
value="es", label=es["language"])
|
| 317 |
intro = gr.Markdown(es["intro"])
|
| 318 |
route = gr.Radio(choices=[(v, k) for k, v in es["routes"].items()], value="viability",
|
| 319 |
+
label=es["route"], elem_id="route-radio")
|
| 320 |
files = gr.File(label=es["files"], file_count="multiple", type="filepath",
|
| 321 |
file_types=analysis.SUPPORTED_EXTENSIONS)
|
| 322 |
request = gr.Textbox(label=es["request"], placeholder=es["request_placeholder"], lines=3)
|