mohith96 commited on
Commit
879b3b3
·
verified ·
1 Parent(s): 9d12423

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +40 -38
src/streamlit_app.py CHANGED
@@ -1,40 +1,42 @@
1
- import altair as alt
2
- import numpy as np
3
- import pandas as pd
4
  import streamlit as st
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
- """
7
- # Welcome to Streamlit!
8
-
9
- Edit `/streamlit_app.py` to customize this app to your heart's desire :heart:.
10
- If you have any questions, checkout our [documentation](https://docs.streamlit.io) and [community
11
- forums](https://discuss.streamlit.io).
12
-
13
- In the meantime, below is an example of what you can do with just a few lines of code:
14
- """
15
-
16
- num_points = st.slider("Number of points in spiral", 1, 10000, 1100)
17
- num_turns = st.slider("Number of turns in spiral", 1, 300, 31)
18
-
19
- indices = np.linspace(0, 1, num_points)
20
- theta = 2 * np.pi * num_turns * indices
21
- radius = indices
22
-
23
- x = radius * np.cos(theta)
24
- y = radius * np.sin(theta)
25
-
26
- df = pd.DataFrame({
27
- "x": x,
28
- "y": y,
29
- "idx": indices,
30
- "rand": np.random.randn(num_points),
31
- })
32
-
33
- st.altair_chart(alt.Chart(df, height=700, width=700)
34
- .mark_point(filled=True)
35
- .encode(
36
- x=alt.X("x", axis=None),
37
- y=alt.Y("y", axis=None),
38
- color=alt.Color("idx", legend=None, scale=alt.Scale()),
39
- size=alt.Size("rand", legend=None, scale=alt.Scale(range=[1, 150])),
40
- ))
 
 
 
 
1
  import streamlit as st
2
+ from library_summarizer import llm_lib_summarizer_v1
3
+ from command_generator import llm_lib_installer_v1
4
+
5
+ st.title("📂 Compatible Library Summarizer")
6
+
7
+ imported_libraries = st.text_area("Enter the libraries you are importing in your ipynb file:", height=200)
8
+ 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
+ # File uploader widget
13
+ uploaded_file = st.file_uploader("Choose a file", type=["txt"])
14
+
15
+ if uploaded_file is not None:
16
+ st.success(f"File uploaded: {uploaded_file.name}")
17
+
18
+ # Read the file (decode for text files)
19
+
20
+ if st.button("Generate bash 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
+ except Exception as e:
31
+ st.error(f"An error occurred: {e}")
32
+
33
+ with st.spinner("Generating ideal pip install command..."):
34
+ try:
35
+ st.subheader(f"Generated pip install command for python version {python_version}")
36
+ command = llm_lib_installer_v1(imported_libs=summary, python_version=python_version, task=task, api_key=api_key, libraries=libraries)
37
+ st.markdown(command)
38
+ except Exception as e:
39
+ st.error(f"An error occurred: {e}")
40
+ else:
41
+ st.error("Please enter text or upload a file.")
42