File size: 1,771 Bytes
b8ef5a5
879b3b3
 
 
adbfb50
879b3b3
 
 
 
 
 
85b8e07
 
dab4ba4
85b8e07
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b8ef5a5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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.")