| | import streamlit as st |
| | from library_summarizer import llm_lib_summarizer_v1 |
| | from command_generator import llm_lib_installer_v1 |
| |
|
| | st.title("๐ Compatible Library Version Generator") |
| |
|
| | 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) |
| |
|
| | |
| | uploaded_file = st.file_uploader("Choose a file", type=["txt"]) |
| | st.write("Uploaded file:", uploaded_file) |
| |
|
| | if uploaded_file is not None: |
| | st.success(f"File uploaded: {uploaded_file.name}") |
| |
|
| | |
| | libraries = uploaded_file.read().decode("utf-8") |
| | |
| | if st.button("Generate pip command"): |
| | if imported_libraries and uploaded_file: |
| | library = imported_libraries |
| | libraries = uploaded_file.read().decode("utf-8") |
| | 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 text or upload a file.") |
| |
|
| |
|