Update app.py
Browse files
app.py
CHANGED
|
@@ -5,4 +5,25 @@ from langchain_core.output_parsers import StrOutputParser
|
|
| 5 |
from langchain_core.prompts import ChatPromptTemplate
|
| 6 |
from langchain_google_genai import GoogleGenerativeAI
|
| 7 |
|
| 8 |
-
st.markdown("<h1 style='text_align:center; color:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
from langchain_core.prompts import ChatPromptTemplate
|
| 6 |
from langchain_google_genai import GoogleGenerativeAI
|
| 7 |
|
| 8 |
+
st.markdown("<h1 style='text_align:center; color:#1E90FF;'>AI Chat Over Your Docs<h1>",unsafe_allow_html=True)
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
st.title("📄 Document Uploader")
|
| 12 |
+
|
| 13 |
+
# File uploader accepts any type of file
|
| 14 |
+
uploaded_file = st.file_uploader("Upload your document", type=None)
|
| 15 |
+
|
| 16 |
+
if uploaded_file is not None:
|
| 17 |
+
st.success(f"✅ Uploaded: {uploaded_file.name}")
|
| 18 |
+
|
| 19 |
+
# Display file content (if it's text-based)
|
| 20 |
+
try:
|
| 21 |
+
content = uploaded_file.read().decode("utf-8")
|
| 22 |
+
st.text_area("File Content", content, height=300)
|
| 23 |
+
except:
|
| 24 |
+
st.warning("Cannot display this file type directly.")
|
| 25 |
+
|
| 26 |
+
# Optional: Save the file
|
| 27 |
+
with open(f"saved_{uploaded_file.name}", "wb") as f:
|
| 28 |
+
f.write(uploaded_file.getbuffer())
|
| 29 |
+
st.info(f"Saved to: saved_{uploaded_file.name}")
|