mohith96's picture
Upload 3 files
9d12423 verified
raw
history blame
1.66 kB
import streamlit as st
from library_summarizer import llm_lib_summarizer_v1
from command_generator import llm_lib_installer_v1
st.title("๐Ÿ“‚ Compatible Library Summarizer")
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)
# File uploader widget
uploaded_file = st.file_uploader("Choose a file", type=["txt"])
if uploaded_file is not None:
st.success(f"File uploaded: {uploaded_file.name}")
# Read the file (decode for text files)
if st.button("Generate bash command"):
if imported_libraries and uploaded_file:
library = imported_libraries
libraries = uploaded_file.read().decode("utf-8")
with st.spinner("Generating ideal pip install command..."):
try:
summary = llm_lib_summarizer_v1(import_string=library, api_key=api_key)
st.subheader("Summary of Libraries:")
st.code(summary)
st.subheader("Generated pip install command:")
command = llm_lib_installer_v1(imported_libs=summary, python_version="3.10", task="general", 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.")