Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -43,3 +43,30 @@ llm = ChatGroq(
|
|
43 |
max_tokens=200,
|
44 |
callbacks=[LLMCallbackHandler(Path("prompts.jsonl"))],
|
45 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
max_tokens=200,
|
44 |
callbacks=[LLMCallbackHandler(Path("prompts.jsonl"))],
|
45 |
)
|
46 |
+
|
47 |
+
st.title("Blah Blah App Using CrewAI 🚀")
|
48 |
+
st.write("Analyze datasets using natural language queries powered by SQL and CrewAI.")
|
49 |
+
|
50 |
+
# Initialize session state for data persistence
|
51 |
+
if "df" not in st.session_state:
|
52 |
+
st.session_state.df = None
|
53 |
+
|
54 |
+
# Dataset Input
|
55 |
+
input_option = st.radio("Select Dataset Input:", ["Use Hugging Face Dataset", "Upload CSV File"])
|
56 |
+
if input_option == "Use Hugging Face Dataset":
|
57 |
+
dataset_name = st.text_input("Enter Hugging Face Dataset Name:", value="Einstellung/demo-salaries")
|
58 |
+
if st.button("Load Dataset"):
|
59 |
+
try:
|
60 |
+
with st.spinner("Loading dataset..."):
|
61 |
+
dataset = load_dataset(dataset_name, split="train")
|
62 |
+
st.session_state.df = pd.DataFrame(dataset)
|
63 |
+
st.success(f"Dataset '{dataset_name}' loaded successfully!")
|
64 |
+
st.dataframe(st.session_state.df.head())
|
65 |
+
except Exception as e:
|
66 |
+
st.error(f"Error: {e}")
|
67 |
+
elif input_option == "Upload CSV File":
|
68 |
+
uploaded_file = st.file_uploader("Upload CSV File:", type=["csv"])
|
69 |
+
if uploaded_file:
|
70 |
+
st.session_state.df = pd.read_csv(uploaded_file)
|
71 |
+
st.success("File uploaded successfully!")
|
72 |
+
st.dataframe(st.session_state.df.head())
|