Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Akshay Keerthi
Akshay Keerthi

Posted on

Building Query2Excel using Lyzr SDK

Query2Excel simplifies this entire workflow by harnessing the power of theLyzr SDK. At its core, Query2Excel is aStreamlit application that enables users to inputnatural language queries and receive formattedExcel outputs — all with the click of a button. Leveraging Lyzr SDK’sFormulaGen capabilities, Query2Excel translates user queries into Excel formulas, automating the process ofdata extraction and organization.

How Query2Excel Works?

The user interface of Query2Excel is intuitive and user-friendly. Once the query is submitted, Query2Excel’s backend, powered byLyzr SDK, swings into action. The entered query is processed, parsed, and transformed intoExcel formulas using Lyzr’s **FormulaGen **module. The resulting Excel output is then presented to the user, ready for download or further analysis.

Why use Lyzr SDK’s?

WithLyzr SDKs, crafting your ownGenAI application is a breeze, requiring only a few lines of code to get up and running swiftly.

Checkout the Lyzr SDK’s

Lets get Started!
Create a new fileapp.py and use that

import osimport lyzrimport streamlit as stfrom lyzr import FormulaGen
Enter fullscreen modeExit fullscreen mode

In this script, we’re importing necessary modules to build a Streamlit application integrated withLyzr SDK.Streamlit **provides the framework for the web application, while Lyzr SDK offers capabilities for **natural language processing and data manipulation. TheFormulaGen module from Lyzr likely facilitates formula generation based on user inputs, enabling streamlineddata analysis and interaction.

Next Set UpOpenAI 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"]
Enter fullscreen modeExit fullscreen mode

This step secures theAPI key within your application, ensuring its confidentiality and proper usage.

generate = FormulaGen()# Define the Streamlit appdef main():    # Input field for natural language query    query = st.text_input("Enter your natural language query :")    # Generate formulas button    if st.button("Generate"):        if query:            # Generate formulas based on the query            result = generate.spreadsheets(query)            st.write("Results:")            st.write(result)        else:            st.write("Please enter a query.")
Enter fullscreen modeExit fullscreen mode

The application initializes aFormulaGen object fromLyzr SDK, enabling the generation offormulas. Within the Streamlit app's main function, users are prompted to input anatural language query via a text input field. Upon clicking the 'Generate' button, the application checks if a query has been provided.

If so, it calls thespreadsheets method of the FormulaGen object to retrieve formulas based on the query. The resulting formulas are then displayed as output. If no query is entered, the application prompts the user to provide one before proceeding with the generation process.

By leveragingLyzr SDK’s capabilities, the application abstracts away the complexity of formula generation, allowing users to focus on theirdata analysis tasks without getting bogged down in technical details. This user-friendly design fosters accessibility and empowers users of all skill levels to harness the power of natural language processing for their data management needs.

Try out the Application:Query2Excel

Youtube Link:https://youtu.be/tVltzm2Gmas

References
Lyzr Website:Lyzr

Book a Demo:Demo

Lyzr Community Channels:Discord

Slack :Slack

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

  • Joined

More fromAkshay Keerthi

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp