savesta / example_usage.py
migoamr's picture
Upload example_usage.py with huggingface_hub
9c88a1d verified
# ==========================================================
# 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")