Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1051,25 +1051,22 @@ def show_explanation(exp_type):
|
|
| 1051 |
"شرایط جوی: هوای بارانی (++)"
|
| 1052 |
],
|
| 1053 |
"counterfactual": [
|
| 1054 |
-
"اگرعجله ندارید و درخواست خود را 1 ساعت بعد تکرار کنید، احتمالاً تقاضا کمترخواهد بود، رانندگان فعال در اطراف شما بیشتر خواهد بود، زمان روز و شرایط جوی بهتر خواهد بود؛ پس قیمت حدوداً 40٪ کمتر (
|
| 1055 |
]
|
| 1056 |
}
|
| 1057 |
|
| 1058 |
-
if exp_type
|
|
|
|
|
|
|
| 1059 |
if exp_type == "input":
|
| 1060 |
-
st.markdown("<p class='explanation-title'>توضیح رهیار درمورد علت قیمت گذاری:</p>", unsafe_allow_html=True)
|
| 1061 |
st.markdown("""
|
| 1062 |
<div style="direction: rtl; text-align: right;">
|
| 1063 |
<span style="font-size: 0.9em; color: #666;">(تعداد علامت + نشان دهنده شدت اثر عامل بر قیمت است)</span>
|
| 1064 |
</div>
|
| 1065 |
""", unsafe_allow_html=True)
|
| 1066 |
-
|
| 1067 |
-
|
| 1068 |
-
|
| 1069 |
-
elif exp_type == "counterfactual":
|
| 1070 |
-
st.markdown("<p class='explanation-title'>توضیح رهیار درمورد علت قیمت گذاری:</p>", unsafe_allow_html=True)
|
| 1071 |
-
for item in explanations.get(exp_type, []):
|
| 1072 |
-
st.markdown(f"<p class='explanation-item'>• {item}</p>", unsafe_allow_html=True)
|
| 1073 |
|
| 1074 |
# ========== توابع مدیریت دادهها ==========
|
| 1075 |
|
|
@@ -1244,8 +1241,7 @@ def map_view():
|
|
| 1244 |
st.markdown("### مسیر سفر شما")
|
| 1245 |
folium_static(create_ride_map(), width=1000 if st.session_state.is_desktop else 800,
|
| 1246 |
height=500 if st.session_state.is_desktop else 400)
|
| 1247 |
-
|
| 1248 |
-
# قیمت
|
| 1249 |
st.markdown(f"""
|
| 1250 |
<div class="price-container">
|
| 1251 |
<div style="display: flex; justify-content: space-between; align-items: center;">
|
|
@@ -1700,10 +1696,20 @@ def main():
|
|
| 1700 |
if 'answers' not in st.session_state:
|
| 1701 |
st.session_state.answers = {}
|
| 1702 |
|
|
|
|
| 1703 |
if 'current_page' not in st.session_state:
|
| 1704 |
st.session_state.current_page = "welcome"
|
| 1705 |
-
|
| 1706 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1707 |
st.session_state.user_contact = None
|
| 1708 |
st.session_state.demographic_data = None
|
| 1709 |
st.session_state.price_accepted = 0
|
|
|
|
| 1051 |
"شرایط جوی: هوای بارانی (++)"
|
| 1052 |
],
|
| 1053 |
"counterfactual": [
|
| 1054 |
+
f"اگر عجله ندارید و درخواست خود را 1 ساعت بعد تکرار کنید، احتمالاً تقاضا کمتر خواهد بود، رانندگان فعال در اطراف شما بیشتر خواهد بود، زمان روز و شرایط جوی بهتر خواهد بود؛ پس قیمت حدوداً 40٪ کمتر ({int(st.session_state.price * 0.6):,} تومان) خواهد بود.",
|
| 1055 |
]
|
| 1056 |
}
|
| 1057 |
|
| 1058 |
+
if exp_type in ["input", "counterfactual"]:
|
| 1059 |
+
st.markdown("<p class='explanation-title'>توضیح رهیار درمورد علت قیمت گذاری:</p>", unsafe_allow_html=True)
|
| 1060 |
+
|
| 1061 |
if exp_type == "input":
|
|
|
|
| 1062 |
st.markdown("""
|
| 1063 |
<div style="direction: rtl; text-align: right;">
|
| 1064 |
<span style="font-size: 0.9em; color: #666;">(تعداد علامت + نشان دهنده شدت اثر عامل بر قیمت است)</span>
|
| 1065 |
</div>
|
| 1066 |
""", unsafe_allow_html=True)
|
| 1067 |
+
|
| 1068 |
+
for item in explanations.get(exp_type, []):
|
| 1069 |
+
st.markdown(f"<p class='explanation-item'>• {item}</p>", unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1070 |
|
| 1071 |
# ========== توابع مدیریت دادهها ==========
|
| 1072 |
|
|
|
|
| 1241 |
st.markdown("### مسیر سفر شما")
|
| 1242 |
folium_static(create_ride_map(), width=1000 if st.session_state.is_desktop else 800,
|
| 1243 |
height=500 if st.session_state.is_desktop else 400)
|
| 1244 |
+
# قیمت
|
|
|
|
| 1245 |
st.markdown(f"""
|
| 1246 |
<div class="price-container">
|
| 1247 |
<div style="display: flex; justify-content: space-between; align-items: center;">
|
|
|
|
| 1696 |
if 'answers' not in st.session_state:
|
| 1697 |
st.session_state.answers = {}
|
| 1698 |
|
| 1699 |
+
|
| 1700 |
if 'current_page' not in st.session_state:
|
| 1701 |
st.session_state.current_page = "welcome"
|
| 1702 |
+
# ایجاد 4 شرط مختلف
|
| 1703 |
+
conditions = [
|
| 1704 |
+
{"price": 120000, "scenario_type": "input"},
|
| 1705 |
+
{"price": 120000, "scenario_type": "counterfactual"},
|
| 1706 |
+
{"price": 200000, "scenario_type": "input"},
|
| 1707 |
+
{"price": 200000, "scenario_type": "counterfactual"}
|
| 1708 |
+
]
|
| 1709 |
+
# انتخاب تصادفی یکی از شرایط
|
| 1710 |
+
selected_condition = random.choice(conditions)
|
| 1711 |
+
st.session_state.price = selected_condition["price"]
|
| 1712 |
+
st.session_state.scenario_type = selected_condition["scenario_type"]
|
| 1713 |
st.session_state.user_contact = None
|
| 1714 |
st.session_state.demographic_data = None
|
| 1715 |
st.session_state.price_accepted = 0
|