mohith96 commited on
Commit
dab4ba4
·
verified ·
1 Parent(s): bc84964

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +23 -30
src/streamlit_app.py CHANGED
@@ -10,35 +10,28 @@ task = st.text_input("Enter the task you are working on (e.g., data analysis, ma
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
  # File uploader widget
13
- uploaded_file = st.file_uploader("Choose a TXT file with all the library versions available in the colab session")
14
- st.write("Uploaded file:", uploaded_file)
15
-
16
- if uploaded_file is not None:
17
- st.success(f"File uploaded: {uploaded_file.name}")
18
-
19
- # Read the file (decode for text files)
20
- libraries = uploaded_file.read().decode("utf-8")
21
 
22
- if st.button("Generate pip command"):
23
- if imported_libraries and uploaded_file:
24
- library = imported_libraries
25
- libraries = uploaded_file.read().decode("utf-8")
26
- with st.spinner("Summarizing imported libraries"):
27
- try:
28
- summary = llm_lib_summarizer_v1(import_string=library, api_key=api_key)
29
- st.subheader("Summary of Libraries:")
30
- st.code(summary)
31
-
32
- except Exception as e:
33
- st.error(f"An error occurred: {e}")
34
-
35
- with st.spinner("Generating ideal pip install command..."):
36
- try:
37
- st.subheader(f"Generated pip install command for python version {python_version}")
38
- command = llm_lib_installer_v1(imported_libs=summary, python_version=python_version, task=task, api_key=api_key, libraries=libraries)
39
- st.markdown(command)
40
- except Exception as e:
41
- st.error(f"An error occurred: {e}")
42
- else:
43
- st.error("Please enter text or upload a file.")
44
 
 
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
  # File uploader widget
13
+ with open('libraries.txt','r') as f:
14
+ libraries = f.read()
 
 
 
 
 
 
15
 
16
+ if st.button("Generate pip command"):
17
+ if imported_libraries:
18
+ library = imported_libraries
19
+ with st.spinner("Summarizing imported libraries"):
20
+ try:
21
+ summary = llm_lib_summarizer_v1(import_string=library, api_key=api_key)
22
+ st.subheader("Summary of Libraries:")
23
+ st.code(summary)
24
+
25
+ except Exception as e:
26
+ st.error(f"An error occurred: {e}")
27
+
28
+ with st.spinner("Generating ideal pip install command..."):
29
+ try:
30
+ st.subheader(f"Generated pip install command for python version {python_version}")
31
+ command = llm_lib_installer_v1(imported_libs=summary, python_version=python_version, task=task, api_key=api_key, libraries=libraries)
32
+ st.markdown(command)
33
+ except Exception as e:
34
+ st.error(f"An error occurred: {e}")
35
+ else:
36
+ st.error("Please enter the libraries you imported in the colab notebook.")
 
37