|
|
import streamlit as st |
|
|
import pandas as pd |
|
|
import numpy as np |
|
|
from langchain_core.output_parsers import StrOutputParser |
|
|
from langchain_core.prompts import ChatPromptTemplate |
|
|
from langchain_google_genai import GoogleGenerativeAI |
|
|
|
|
|
st.markdown("<h1 style='text_align:center; color:#1E90FF;'>AI Chat Over Your Docs<h1>",unsafe_allow_html=True) |
|
|
|
|
|
|
|
|
st.title("📄 Document Uploader") |
|
|
|
|
|
|
|
|
uploaded_file = st.file_uploader("Upload your document", type=None) |
|
|
|
|
|
if uploaded_file is not None: |
|
|
st.success(f"✅ Uploaded: {uploaded_file.name}") |
|
|
|
|
|
|
|
|
try: |
|
|
content = uploaded_file.read().decode("utf-8") |
|
|
st.text_area("File Content", content, height=300) |
|
|
except: |
|
|
st.warning("Cannot display this file type directly.") |
|
|
|
|
|
|
|
|
with open(f"saved_{uploaded_file.name}", "wb") as f: |
|
|
f.write(uploaded_file.getbuffer()) |
|
|
st.info(f"Saved to: saved_{uploaded_file.name}") |
|
|
|