Updated streamlit UI

This commit is contained in:
Sri Charan Thoutam
2025-01-14 20:28:18 +05:30
parent bfd2314f72
commit 3e27c9c824
2 changed files with 20 additions and 15 deletions

View File

@@ -3,8 +3,8 @@
## Overview ## Overview
PharmaQuery is an advanced Pharmaceutical Insight Retrieval System designed to help users gain meaningful insights from research papers and documents in the pharmaceutical domain. PharmaQuery is an advanced Pharmaceutical Insight Retrieval System designed to help users gain meaningful insights from research papers and documents in the pharmaceutical domain.
## PharmaQuery Architecture ## Demo
![PharmaQuery-Architecture](https://github.com/user-attachments/assets/c8a2cff7-f004-415c-8b1e-5387999680b4) https://github.com/user-attachments/assets/c12ee305-86fe-4f71-9219-57c7f438f291
## Features ## Features
- **Natural Language Querying**: Ask complex questions about the pharmaceutical industry and get concise, accurate answers. - **Natural Language Querying**: Ask complex questions about the pharmaceutical industry and get concise, accurate answers.
@@ -28,21 +28,13 @@ PharmaQuery is an advanced Pharmaceutical Insight Retrieval System designed to h
pip install -r requirements.txt pip install -r requirements.txt
``` ```
2. **Set Up Environment Variables**: 2. **Run the Application**:
Create a `.env` file in the project root directory with the following variables:
```bash
GOOGLE_API_KEY="your_google_gemini_api_key"
```
`Note:` Replace `your_google_gemini_api_key` with actual key.
3. **Run the Application**:
```bash ```bash
streamlit run app.py streamlit run app.py
``` ```
4. **Use the Application**: 3. **Use the Application**:
- Paste your Google API Key in the sidebar.
- Enter your query in the main interface. - Enter your query in the main interface.
- Optionally, upload research papers in the sidebar to enhance the database. - Optionally, upload research papers in the sidebar to enhance the database.

View File

@@ -84,6 +84,7 @@ def run_rag_chain(query):
# Initialize a Generator (i.e. Chat Model) # Initialize a Generator (i.e. Chat Model)
chat_model = ChatGoogleGenerativeAI( chat_model = ChatGoogleGenerativeAI(
model="gemini-1.5-pro", model="gemini-1.5-pro",
api_key=st.session_state.get("gemini_api_key"),
temperature=1 temperature=1
) )
@@ -117,8 +118,20 @@ def main():
st.write(result) st.write(result)
with st.sidebar: with st.sidebar:
st.title("Upload your research documents (Optional) :memo:") st.title("API Keys")
pdf_docs = st.file_uploader("Enhance your query by uploading PDF files related to Pharmaceutical Sciences.", gemini_api_key = st.text_input("Enter your Gemini API key:", type="password")
if st.button("Enter"):
if gemini_api_key:
st.session_state.gemini_api_key = gemini_api_key
st.success("API key saved!")
else:
st.warning("Please enter your Gemini API key to proceed.")
with st.sidebar:
st.markdown("---")
pdf_docs = st.file_uploader("Upload your research documents related to Pharmaceutical Sciences (Optional) :memo:",
type=["pdf"], type=["pdf"],
accept_multiple_files=True accept_multiple_files=True
) )