import streamlit as st from data_preprocessing import preprocess_csv from question_answering import answer_query # Streamlit app st.title("Question Answering App") # Textbox for user query user_query = st.text_input("Enter your question:") # File uploader for context (Hugging Face specific) uploaded_file = st.file_uploader("Upload a CSV file from Hugging Face Hub:", type="text") if uploaded_file is not None: # Extract file URL file_url = uploaded_file.url # Preprocess the CSV data context = preprocess_csv(file_url) else: # Use default context (optional) context = "This is a sample context for demonstration purposes. You can upload your own text file or CSV file for context." # Answer the query if a question is provided if user_query: answer = answer_from_csv(user_query, context) st.write(f"Answer: {answer}") else: st.write("Please enter a question.")