| import streamlit as st | |
| from library_summarizer import llm_lib_summarizer_v1 | |
| from command_generator import llm_lib_installer_v1 | |
| st.title("๐ LLM Python Package Installer") | |
| imported_libraries = st.text_area("Enter the libraries you are importing in your ipynb file:", height=200) | |
| api_key = st.text_input("Enter your Groq API Key:", type="password") | |
| task = st.text_input("Enter the task you are working on (e.g., data analysis, machine learning):", value="Basic ML task") | |
| python_version = st.selectbox("Select your Python version:", options=["3.7", "3.8", "3.9", "3.10", "3.11","3.12"], index=3) | |
| with open('libraries.txt','r') as f: | |
| libraries = f.read() | |
| if st.button("Generate pip command"): | |
| if imported_libraries: | |
| library = imported_libraries | |
| with st.spinner("Summarizing imported libraries"): | |
| try: | |
| summary = llm_lib_summarizer_v1(import_string=library, api_key=api_key) | |
| st.subheader("Summary of Libraries:") | |
| st.code(summary) | |
| except Exception as e: | |
| st.error(f"An error occurred: {e}") | |
| with st.spinner("Generating ideal pip install command..."): | |
| try: | |
| st.subheader(f"Generated pip install command for python version {python_version}") | |
| command = llm_lib_installer_v1(imported_libs=summary, python_version=python_version, task=task, api_key=api_key, libraries=libraries) | |
| st.markdown(command) | |
| except Exception as e: | |
| st.error(f"An error occurred: {e}") | |
| else: | |
| st.error("Please enter the libraries you imported in the colab notebook.") | |