In the realm of real estate, navigating through vast amounts of data ** can be overwhelming. From property prices to **market trends, making informed decisions requires a deep understanding of various factors. However, what if there was a tool that could streamline this process, making complex data analysis simple and stress-free?
Introducing Real Estate Navigator, powered by** Lyzr**. This innovative application leverages the capabilities of Lyzr to revolutionize the way we analyze real estate data.At its core, Real Estate Navigator is designed to provide a seamless experience for analyzing real estate data.
Why use Lyzr SDK’s?
With Lyzr SDKs, crafting your own GenAI application is a breeze, requiring only a few lines of code to get up and running swiftly.
Lets get Started!
Create a new file app.py and use that
import os
import streamlit as st
from utils import utils
from lyzr import DataConnector, DataAnalyzr
From this snippet, you’re utilizing custom utility functions from the utils module, as well as functionalities from the lyzr module, including DataConnector for connecting to data sources and DataAnalyzr for analysis tasks. Streamlit enables you to build interactive web-based interfaces directly from your Python code, simplifying the process of creating data-driven applications.
Next Set Up OpenAI API Key and using Streamlit’s secrets management, set up the OpenAI API key within your Streamlit application. Replace "OPENAI_API_KEY" with the actual key name defined in your Streamlit secrets where your OpenAI API key is stored.
openai.api_key = st.secrets["OPENAI_API_KEY"]
def data_uploader():
st.subheader("Upload Real Estate CSV file")
# Upload csv file
uploaded_file = st.file_uploader("Choose csv file", type=["csv"])
if uploaded_file is not None:
utils.save_uploaded_file(uploaded_file)
else:
utils.remove_existing_files(data)
utils.remove_existing_files(plot)
The function data_uploader creates an interface within a Streamlit application for users to upload a CSV file related to real estate data. It displays a subheader prompting users to upload a CSV file, and if a file is uploaded, it utilizes a utility function **save_uploaded_file **from the **utils module **to save the uploaded file. Additionally, if no file is uploaded, it invokes other utility functions from utils to remove any existing files associated with the data and plot.
def analyzr():
path = utils.get_files_in_directory(data)
path = path[0]
dataframe = DataConnector().fetch_dataframe_from_csv(file_path=Path(path))
analyzr_instance = DataAnalyzr(df=dataframe, api_key=st.secrets["apikey"])
return analyzr_instance
Here in the above snippet, the analyzr function retrieves a CSV file path from a directory, loads its content into a DataFrame using DataConnector, and then initializes a DataAnalyzr instance with the DataFrame and a Streamlit API key. This function succinctly manages the data analysis process within the application, encapsulating tasks related to data retrieval and analysis initiation.
def file_checker():
file = []
for filename in os.listdir(data):
file_path = os.path.join(data, filename)
file.append(file_path)
return file
In the above code , the file_checker function scans a directory (data) for files and constructs a list containing their file paths. It iterates through each file in the directory using os.listdir, constructs the full file path using os.path.join, and appends it to the file list. Finally, it returns the list of file paths.
# Function to display the dataset description
def display_description(analyzr):
description = analyzr.dataset_description()
if description is not None:
st.subheader("Dataset Description:")
st.write(description)
Here the display_description function retrieves the dataset description from the provided analyzr instance and displays it within the Streamlit application. It first calls the dataset_description method of the analyzr object to obtain the description. If a description is available (not None), it then displays it using Streamlit's subheader and write functions.
# Function to display queries
def display_queries(analyzr):
queries = analyzr.ai_queries_df()
if queries is not None:
st.subheader("These Queries you can run on the data:")
st.write(queries)
The display_queries function retrieves queries that can be run on the dataset from the provided analyzr instance and displays them within the Streamlit application. It calls the ai_queries_df method of the analyzr object to obtain the queries. If queries are available (not None), it then displays them using Streamlit's subheader and write functions. This function effectively presents available queries, assisting users in exploring and analyzing the dataset.
Ready to unlock the full potential of your real estate data? Try out Real Estate Navigator today and experience the future of data-driven decision-making. Whether you’re a real estate professional, investor, or enthusiast, Real Estate Navigator empowers you to make smarter decisions, faster.
Connect with Lyzr
To learn more about Lyzr and its SDK’s, visit our website or get in touch with our team:
Website: Lyzr.ai
Book a Demo: Book a Demo
Discord: Join our Discord community
Top comments (0)