Update src/streamlit_app.py
Browse files- src/streamlit_app.py +23 -29
src/streamlit_app.py
CHANGED
|
@@ -9,34 +9,28 @@ api_key = st.text_input("Enter your Groq API Key:", type="password")
|
|
| 9 |
task = st.text_input("Enter the task you are working on (e.g., data analysis, machine learning):", value="Basic ML task")
|
| 10 |
python_version = st.selectbox("Select your Python version:", options=["3.7", "3.8", "3.9", "3.10", "3.11","3.12"], index=3)
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
if uploaded_file is not None:
|
| 16 |
-
st.success(f"File uploaded: {uploaded_file.name}")
|
| 17 |
-
|
| 18 |
-
libraries = uploaded_file.read().decode('utf-8')
|
| 19 |
-
|
| 20 |
-
if st.button("Generate pip command"):
|
| 21 |
-
if imported_libraries and uploaded_file:
|
| 22 |
-
library = imported_libraries
|
| 23 |
-
libraries = uploaded_file.read().decode('utf-8')
|
| 24 |
-
with st.spinner("Summarizing imported libraries"):
|
| 25 |
-
try:
|
| 26 |
-
summary = llm_lib_summarizer_v1(import_string=library, api_key=api_key)
|
| 27 |
-
st.subheader("Summary of Libraries:")
|
| 28 |
-
st.code(summary)
|
| 29 |
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
|
|
|
| 9 |
task = st.text_input("Enter the task you are working on (e.g., data analysis, machine learning):", value="Basic ML task")
|
| 10 |
python_version = st.selectbox("Select your Python version:", options=["3.7", "3.8", "3.9", "3.10", "3.11","3.12"], index=3)
|
| 11 |
|
| 12 |
+
with 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_libraries
|
| 18 |
+
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 |
|