Spaces:
Running
Running
update
Browse files- src/pages/1_Chart_Generation.py +2 -0
- src/pages/3_Metadata.py +38 -0
src/pages/1_Chart_Generation.py
CHANGED
@@ -16,6 +16,8 @@ def main():
|
|
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")
|
|
|
16 |
api_key = st.session_state.api_key
|
17 |
project_id = st.session_state.project_id
|
18 |
|
19 |
+
st.markdown('Using APIs: [https://cloud.getwren.ai/api/v1/generate_sql](https://wrenai.readme.io/reference/cloud_post_generate-sql), [https://cloud.getwren.ai/api/v1/generate_vega_chart](https://wrenai.readme.io/reference/cloud_post_generate-vega-chart)')
|
20 |
+
|
21 |
# Sidebar for API configuration
|
22 |
with st.sidebar:
|
23 |
st.header("π§ Configuration")
|
src/pages/3_Metadata.py
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
from apis import get_models
|
4 |
+
|
5 |
+
|
6 |
+
def main():
|
7 |
+
st.title("π Wren AI Cloud API Demo - Metadata")
|
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 |
+
st.markdown('Using APIs: [https://cloud.getwren.ai/api/v1/projects/{projectId}/models](https://wrenai.readme.io/reference/get_projects-projectid-models)')
|
20 |
+
|
21 |
+
# Get and display models
|
22 |
+
with st.spinner("π Loading models..."):
|
23 |
+
models_response, error = get_models(api_key, project_id)
|
24 |
+
|
25 |
+
if models_response:
|
26 |
+
models = models_response.get("models", [])
|
27 |
+
|
28 |
+
if models:
|
29 |
+
st.markdown(f"Here is your latest deployed models in MDL (Model Definition Language) format in project {project_id}.")
|
30 |
+
st.json(models, expanded=True)
|
31 |
+
else:
|
32 |
+
st.info("No models found in this project.")
|
33 |
+
else:
|
34 |
+
st.error(f"Failed to load models: {error}")
|
35 |
+
|
36 |
+
|
37 |
+
if __name__ == "__main__":
|
38 |
+
main()
|