Spaces:
Running
Running
File size: 987 Bytes
e04dd70 f85c548 e04dd70 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
import streamlit as st
from app import client, default_embedding_function
import pandas as pd
from generate_kb import generate_knowledge_box_from_url
# Title of the app
st.title("Create a knowledge box from CSV file")
# File uploader widget
uploaded_file = st.file_uploader("Choose a CSV file", type=["csv"])
df = None
if uploaded_file is not None:
try:
df = pd.read_csv(uploaded_file)
st.write("DataFrame:")
st.write(df)
except Exception as e:
st.error(str(e))
if uploaded_file is not None:
st.text("dont use spaces but underscores _ in your new name")
kb_name = st.text_input(label="new knowledge base name")
if st.button("Generate new knowledge box"):
urls = df.values.tolist()
res = generate_knowledge_box_from_url(
client=client,
urls=urls,
kb_name=kb_name,
embedding_fct=default_embedding_function,
chunk_size=2_000,
)
st.json(res)
|