lunarrray commited on
Commit
ac58f1d
·
1 Parent(s): 0eacdfe

fields names updated

Browse files
Files changed (1) hide show
  1. app.py +38 -14
app.py CHANGED
@@ -54,11 +54,35 @@ FIELD_ORDER = [
54
  DEFAULT_FIELDS = set(VOCAB["defaults"].keys()) - set(FIELD_ORDER)
55
 
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  def _dropdown(field, filterable=False):
58
  return gr.Dropdown(
59
  choices=CATEGORIES[field],
60
  value=example_listing[field],
61
- label=field,
62
  allow_custom_value=False,
63
  filterable=filterable,
64
  )
@@ -74,33 +98,33 @@ def build_form():
74
  inputs["district"] = _dropdown("district", filterable=True)
75
  inputs["property_type"] = _dropdown("property_type")
76
  inputs["deal"] = _dropdown("deal")
77
- inputs["area_m2"] = gr.Number(value=example_listing["area_m2"], label="area_m2 (площадь, м²)")
78
- inputs["rooms"] = gr.Textbox(value=example_listing["rooms"], label="rooms (комнаты, текстом)")
79
  inputs["condition"] = _dropdown("condition")
80
  inputs["deal_terms"] = _dropdown("deal_terms")
81
 
82
  with gr.Column():
83
  gr.Markdown("### Цена")
84
- inputs["price"] = gr.Number(value=example_listing["price"], label="price")
85
  inputs["currency"] = _dropdown("currency")
86
- inputs["is_negotiable"] = gr.Checkbox(value=bool(example_listing["is_negotiable"]), label="is_negotiable (торг уместен)")
87
 
88
  gr.Markdown("### Фотографии")
89
- inputs["image_count"] = gr.Number(value=example_listing["image_count"], label="image_count")
90
- inputs["img_count"] = gr.Number(value=example_listing["img_count"], label="img_count")
91
 
92
  with gr.Accordion("Настройки объявления", open=False):
93
- inputs["is_vip"] = gr.Checkbox(value=bool(example_listing["is_vip"]), label="is_vip")
94
- inputs["is_ppv"] = gr.Checkbox(value=bool(example_listing["is_ppv"]), label="is_ppv")
95
- inputs["has_daily_views"] = gr.Checkbox(value=bool(example_listing["has_daily_views"]), label="has_daily_views")
96
- inputs["hide_phone"] = gr.Checkbox(value=bool(example_listing["hide_phone"]), label="hide_phone")
97
  inputs["hide_chat"] = gr.Radio(
98
  choices=["не указано", "да", "нет"],
99
  value=HIDE_CHAT_REVERSE[example_listing["hide_chat"]],
100
- label="hide_chat",
101
  )
102
- inputs["is_hide_house_number"] = gr.Checkbox(value=bool(example_listing["is_hide_house_number"]), label="is_hide_house_number")
103
- inputs["params_count"] = gr.Number(value=example_listing["params_count"], label="params_count")
104
 
105
  return inputs
106
 
 
54
  DEFAULT_FIELDS = set(VOCAB["defaults"].keys()) - set(FIELD_ORDER)
55
 
56
 
57
+ FIELD_LABELS = {
58
+ "city": "Город",
59
+ "district": "Район",
60
+ "property_type": "Тип недвижимости",
61
+ "deal": "Тип сделки",
62
+ "area_m2": "Площадь, м²",
63
+ "rooms": "Количество комнат",
64
+ "condition": "Состояние ремонта",
65
+ "deal_terms": "Условия сделки",
66
+ "price": "Цена",
67
+ "currency": "Валюта",
68
+ "is_negotiable": "Торг уместен",
69
+ "image_count": "Число фото (заявлено)",
70
+ "img_count": "Число фото (обработано)",
71
+ "is_vip": "VIP-объявление",
72
+ "is_ppv": "Продвижение (PPV)",
73
+ "has_daily_views": "Показ ежедневных просмотров",
74
+ "hide_phone": "Скрыт телефон",
75
+ "hide_chat": "Скрыт чат",
76
+ "is_hide_house_number": "Скрыт номер дома",
77
+ "params_count": "Число заполненных параметров",
78
+ }
79
+
80
+
81
  def _dropdown(field, filterable=False):
82
  return gr.Dropdown(
83
  choices=CATEGORIES[field],
84
  value=example_listing[field],
85
+ label=FIELD_LABELS[field],
86
  allow_custom_value=False,
87
  filterable=filterable,
88
  )
 
98
  inputs["district"] = _dropdown("district", filterable=True)
99
  inputs["property_type"] = _dropdown("property_type")
100
  inputs["deal"] = _dropdown("deal")
101
+ inputs["area_m2"] = gr.Number(value=example_listing["area_m2"], label=FIELD_LABELS["area_m2"])
102
+ inputs["rooms"] = gr.Textbox(value=example_listing["rooms"], label=FIELD_LABELS["rooms"])
103
  inputs["condition"] = _dropdown("condition")
104
  inputs["deal_terms"] = _dropdown("deal_terms")
105
 
106
  with gr.Column():
107
  gr.Markdown("### Цена")
108
+ inputs["price"] = gr.Number(value=example_listing["price"], label=FIELD_LABELS["price"])
109
  inputs["currency"] = _dropdown("currency")
110
+ inputs["is_negotiable"] = gr.Checkbox(value=bool(example_listing["is_negotiable"]), label=FIELD_LABELS["is_negotiable"])
111
 
112
  gr.Markdown("### Фотографии")
113
+ inputs["image_count"] = gr.Number(value=example_listing["image_count"], label=FIELD_LABELS["image_count"])
114
+ inputs["img_count"] = gr.Number(value=example_listing["img_count"], label=FIELD_LABELS["img_count"])
115
 
116
  with gr.Accordion("Настройки объявления", open=False):
117
+ inputs["is_vip"] = gr.Checkbox(value=bool(example_listing["is_vip"]), label=FIELD_LABELS["is_vip"])
118
+ inputs["is_ppv"] = gr.Checkbox(value=bool(example_listing["is_ppv"]), label=FIELD_LABELS["is_ppv"])
119
+ inputs["has_daily_views"] = gr.Checkbox(value=bool(example_listing["has_daily_views"]), label=FIELD_LABELS["has_daily_views"])
120
+ inputs["hide_phone"] = gr.Checkbox(value=bool(example_listing["hide_phone"]), label=FIELD_LABELS["hide_phone"])
121
  inputs["hide_chat"] = gr.Radio(
122
  choices=["не указано", "да", "нет"],
123
  value=HIDE_CHAT_REVERSE[example_listing["hide_chat"]],
124
+ label=FIELD_LABELS["hide_chat"],
125
  )
126
+ inputs["is_hide_house_number"] = gr.Checkbox(value=bool(example_listing["is_hide_house_number"]), label=FIELD_LABELS["is_hide_house_number"])
127
+ inputs["params_count"] = gr.Number(value=example_listing["params_count"], label=FIELD_LABELS["params_count"])
128
 
129
  return inputs
130