B2BEnterprise/Python_library_installer
0
1import streamlit as st2from library_summarizer import llm_lib_summarizer_v13from command_generator import llm_lib_installer_v14 5st.title("๐ LLM Python Package Installer")6 7imported_libraries = st.text_area("Enter the libraries you are importing in your ipynb file:", height=200)8api_key = st.text_input("Enter your Groq API Key:", type="password")9task = st.text_input("Enter the task you are working on (e.g., data analysis, machine learning):", value="Basic ML task")10python_version = st.selectbox("Select your Python version:", options=["3.7", "3.8", "3.9", "3.10", "3.11","3.12"], index=3)11 12with open('libraries.txt','r') as f:13 libraries = f.read()14 15 if st.button("Generate pip command"):16 if imported_libraries:17 library = imported_libraries18 with st.spinner("Summarizing imported libraries"):19 try:20 summary = llm_lib_summarizer_v1(import_string=library, api_key=api_key)21 st.subheader("Summary of Libraries:")22 st.code(summary)23 24 except Exception as e:25 st.error(f"An error occurred: {e}")26 27 with st.spinner("Generating ideal pip install command..."): 28 try:29 st.subheader(f"Generated pip install command for python version {python_version}")30 command = llm_lib_installer_v1(imported_libs=summary, python_version=python_version, task=task, api_key=api_key, libraries=libraries)31 st.markdown(command)32 except Exception as e:33 st.error(f"An error occurred: {e}")34 else:35 st.error("Please enter the libraries you imported in the colab notebook.")36 37 