File size: 974 Bytes
9c88a1d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# ==========================================================
# Example usage for Egypt Real Estate Price Prediction
# ==========================================================
from transformers import pipeline

HF_MODEL_ID = "migoamr/savesta"
regressor = pipeline("text-classification", model=HF_MODEL_ID)

def predict_price(area_m2, rooms, bathrooms, description, location, property_type):
    text_input = f"Area: {area_m2} sqm, Rooms: {rooms}, Bathrooms: {bathrooms}. Description: {description}. Location: {location}. Type: {property_type}."
    result = regressor(text_input)
    predicted_price = result[0]['score']
    return predicted_price

if __name__ == "__main__":
    price = predict_price(
        area_m2=180,
        rooms=3,
        bathrooms=2,
        description="Luxury apartment with panoramic views",
        location="Fifth Settlement, New Cairo",
        property_type="Apartment"
    )
    print(f"🏠 Predicted Property Price: {price:,.0f} EGP")