Spaces:
Running
Running
update instructions on home page and refine configuraiton panel
Browse files
src/Home.py
CHANGED
@@ -9,11 +9,39 @@ st.set_page_config(
|
|
9 |
)
|
10 |
|
11 |
st.title("π Wren AI Cloud API Demo")
|
12 |
-
|
13 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
st.markdown(
|
15 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
**Resources:**
|
|
|
17 |
- Wren AI official website: https://getwren.ai/
|
18 |
- API Documentation: https://wrenai.readme.io/reference/cloud-getting-started
|
19 |
- Demo Source Code: https://huggingface.co/spaces/getWrenAI/wrenai-cloud-api-demo/tree/main
|
|
|
9 |
)
|
10 |
|
11 |
st.title("π Wren AI Cloud API Demo")
|
12 |
+
|
13 |
+
if "api_key" not in st.session_state:
|
14 |
+
st.session_state.api_key = ""
|
15 |
+
if "project_id" not in st.session_state:
|
16 |
+
st.session_state.project_id = ""
|
17 |
+
|
18 |
+
with st.sidebar:
|
19 |
+
st.header("π§ Configuration")
|
20 |
+
st.session_state.api_key = st.text_input(
|
21 |
+
"API Key",
|
22 |
+
type="password",
|
23 |
+
placeholder="sk-your-api-key-here",
|
24 |
+
help="Enter your Wren AI Cloud API key"
|
25 |
+
)
|
26 |
+
st.session_state.project_id = st.text_input(
|
27 |
+
"Project ID",
|
28 |
+
placeholder="1234",
|
29 |
+
help="Enter your Wren AI Cloud project ID"
|
30 |
+
)
|
31 |
+
|
32 |
st.markdown(
|
33 |
"""
|
34 |
+
**Prerequisites:**
|
35 |
+
|
36 |
+
In order to successfully run the demo, you need to:
|
37 |
+
1. Create a Wren AI Cloud account: https://cloud.getwren.ai/
|
38 |
+
2. Create a project: https://docs.getwren.ai/cloud/getting_started/create_project
|
39 |
+
3. Connect to [your data source](https://docs.getwren.ai/cloud/guide/connect/overview) or [use our sample dataset](https://docs.getwren.ai/cloud/getting_started/sample_data/ecommerce)
|
40 |
+
4. Get your API key: https://docs.getwren.ai/cloud/guide/api-access/keys
|
41 |
+
5. Enter your API key and project ID in the sidebar.
|
42 |
+
|
43 |
**Resources:**
|
44 |
+
|
45 |
- Wren AI official website: https://getwren.ai/
|
46 |
- API Documentation: https://wrenai.readme.io/reference/cloud-getting-started
|
47 |
- Demo Source Code: https://huggingface.co/spaces/getWrenAI/wrenai-cloud-api-demo/tree/main
|
src/pages/{1_Chart_Generation.py β 2_Chart_Generation.py}
RENAMED
@@ -6,21 +6,19 @@ from apis import generate_sql, generate_chart
|
|
6 |
def main():
|
7 |
st.title("π Wren AI Cloud API Demo - Chart Generation")
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
# Sidebar for API configuration
|
10 |
with st.sidebar:
|
11 |
st.header("π§ Configuration")
|
12 |
-
api_key = st.text_input(
|
13 |
-
"API Key",
|
14 |
-
type="password",
|
15 |
-
placeholder="sk-your-api-key-here",
|
16 |
-
help="Enter your Wren AI Cloud API key"
|
17 |
-
)
|
18 |
-
project_id = st.text_input(
|
19 |
-
"Project ID",
|
20 |
-
placeholder="1234",
|
21 |
-
help="Enter your Wren AI Cloud project ID"
|
22 |
-
)
|
23 |
-
|
24 |
# Sample size configuration
|
25 |
sample_size = st.slider(
|
26 |
"Chart Sample Size",
|
@@ -31,18 +29,6 @@ def main():
|
|
31 |
help="Number of data points to include in charts"
|
32 |
)
|
33 |
|
34 |
-
# Main chat interface
|
35 |
-
if not api_key or not project_id:
|
36 |
-
st.warning("β οΈ Please enter your API Key and Project ID in the sidebar to get started.")
|
37 |
-
st.info("""
|
38 |
-
**How to get started:**
|
39 |
-
1. Enter your Wren AI Cloud API Key in the sidebar
|
40 |
-
2. Enter your Project ID
|
41 |
-
3. Ask questions about your data in natural language
|
42 |
-
4. Get SQL queries and interactive charts automatically!
|
43 |
-
""")
|
44 |
-
return
|
45 |
-
|
46 |
# Initialize chat history
|
47 |
if "messages" not in st.session_state:
|
48 |
st.session_state.messages = []
|
|
|
6 |
def main():
|
7 |
st.title("π Wren AI Cloud API Demo - Chart Generation")
|
8 |
|
9 |
+
if "api_key" not in st.session_state or "project_id" not in st.session_state:
|
10 |
+
st.error("Please enter your API Key and Project ID in the sidebar of Home page to get started.")
|
11 |
+
return
|
12 |
+
if not st.session_state.api_key or not st.session_state.project_id:
|
13 |
+
st.error("Please enter your API Key and Project ID in the sidebar of Home page to get started.")
|
14 |
+
return
|
15 |
+
|
16 |
+
api_key = st.session_state.api_key
|
17 |
+
project_id = st.session_state.project_id
|
18 |
+
|
19 |
# Sidebar for API configuration
|
20 |
with st.sidebar:
|
21 |
st.header("π§ Configuration")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
# Sample size configuration
|
23 |
sample_size = st.slider(
|
24 |
"Chart Sample Size",
|
|
|
29 |
help="Number of data points to include in charts"
|
30 |
)
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
# Initialize chat history
|
33 |
if "messages" not in st.session_state:
|
34 |
st.session_state.messages = []
|