TAPASxHF2 / app.py
jskinner215's picture
Upload 17 files
25fc3a2
import streamlit as st
from csv_loader import CSVLoader
from embedding_generator import EmbeddingGenerator
from chroma_db_indexer import ChromaDBIndexer
from question_answerer import QuestionAnswerer
from answer_presenter import AnswerPresenter
def main():
st.title("TAPAS LLM Application")
csv_loader = CSVLoader()
embedding_generator = EmbeddingGenerator()
chroma_db_indexer = ChromaDBIndexer()
question_answerer = QuestionAnswerer()
answer_presenter = AnswerPresenter()
uploaded_files = st.file_uploader("Upload CSV", type='csv', accept_multiple_files=True)
if uploaded_files:
dataframes = csv_loader.load_csvs(uploaded_files)
embeddings = embedding_generator.generate_embeddings(dataframes)
chroma_db_indexer.create_index(embeddings)
query = st.text_input("Enter your question")
if query:
table = question_answerer.query_table(query)
answer = question_answerer.answer_question(query, table)
answer_presenter.present_answer(answer)
if __name__ == "__main__":
main()