Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
-
import
|
| 2 |
|
|
|
|
| 3 |
import streamlit as st
|
| 4 |
from langchain.chains import RetrievalQA
|
| 5 |
from PyPDF2 import PdfReader
|
|
@@ -32,8 +33,8 @@ from openai import OpenAI
|
|
| 32 |
|
| 33 |
# Initialize clients
|
| 34 |
#openai_client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
|
| 35 |
-
atlas_uri = os.getenv("ATLAS_URI")
|
| 36 |
-
url = atlas_uri
|
| 37 |
#client = MongoClient(atlas_uri)
|
| 38 |
|
| 39 |
|
|
@@ -42,7 +43,7 @@ from pymongo import MongoClient
|
|
| 42 |
import certifi
|
| 43 |
|
| 44 |
# Connect to MongoDB Atlas
|
| 45 |
-
client = MongoClient(atlas_uri,tls=True,tlsCAFile=certifi.where())
|
| 46 |
#db = client['sample_mflix']
|
| 47 |
#collection = db['embedded_movies']
|
| 48 |
|
|
@@ -59,7 +60,7 @@ if not all([url,
|
|
| 59 |
ollama_base_url]):
|
| 60 |
st.write("The application requires some information before running.")
|
| 61 |
with st.form("connection_form"):
|
| 62 |
-
url = st.text_input("Enter ATLAS_URI",)
|
| 63 |
#username = st.text_input("Enter NEO4J_USERNAME")
|
| 64 |
#password = st.text_input("Enter NEO4J_PASSWORD", type="password")
|
| 65 |
ollama_base_url = st.text_input("Enter OLLAMA_BASE_URL")
|
|
@@ -68,8 +69,8 @@ if not all([url,
|
|
| 68 |
submit_button = st.form_submit_button("Submit")
|
| 69 |
if submit_button:
|
| 70 |
#if not all([url, username, password, ]):
|
| 71 |
-
if not all([url, ]):
|
| 72 |
-
|
| 73 |
if not (ollama_base_url or openai_apikey):
|
| 74 |
st.write("Enter the Ollama URL or OpenAI API Key.")
|
| 75 |
if openai_apikey:
|
|
@@ -77,7 +78,7 @@ if not all([url,
|
|
| 77 |
os.environ['OPENAI_API_KEY'] = openai_apikey
|
| 78 |
|
| 79 |
#os.environ["NEO4J_URL"] = url
|
| 80 |
-
os.environ["ATLAS_URI"] = url
|
| 81 |
|
| 82 |
logger = get_logger(__name__)
|
| 83 |
|
|
|
|
| 1 |
+
from utils.credentials import check_credentials, init_clients
|
| 2 |
|
| 3 |
+
import os
|
| 4 |
import streamlit as st
|
| 5 |
from langchain.chains import RetrievalQA
|
| 6 |
from PyPDF2 import PdfReader
|
|
|
|
| 33 |
|
| 34 |
# Initialize clients
|
| 35 |
#openai_client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
|
| 36 |
+
#atlas_uri = os.getenv("ATLAS_URI")
|
| 37 |
+
#url = atlas_uri
|
| 38 |
#client = MongoClient(atlas_uri)
|
| 39 |
|
| 40 |
|
|
|
|
| 43 |
import certifi
|
| 44 |
|
| 45 |
# Connect to MongoDB Atlas
|
| 46 |
+
#client = MongoClient(atlas_uri,tls=True,tlsCAFile=certifi.where())
|
| 47 |
#db = client['sample_mflix']
|
| 48 |
#collection = db['embedded_movies']
|
| 49 |
|
|
|
|
| 60 |
ollama_base_url]):
|
| 61 |
st.write("The application requires some information before running.")
|
| 62 |
with st.form("connection_form"):
|
| 63 |
+
#url = st.text_input("Enter ATLAS_URI",)
|
| 64 |
#username = st.text_input("Enter NEO4J_USERNAME")
|
| 65 |
#password = st.text_input("Enter NEO4J_PASSWORD", type="password")
|
| 66 |
ollama_base_url = st.text_input("Enter OLLAMA_BASE_URL")
|
|
|
|
| 69 |
submit_button = st.form_submit_button("Submit")
|
| 70 |
if submit_button:
|
| 71 |
#if not all([url, username, password, ]):
|
| 72 |
+
#if not all([url, ]):
|
| 73 |
+
# st.write("Enter the ATLAS information.")
|
| 74 |
if not (ollama_base_url or openai_apikey):
|
| 75 |
st.write("Enter the Ollama URL or OpenAI API Key.")
|
| 76 |
if openai_apikey:
|
|
|
|
| 78 |
os.environ['OPENAI_API_KEY'] = openai_apikey
|
| 79 |
|
| 80 |
#os.environ["NEO4J_URL"] = url
|
| 81 |
+
#os.environ["ATLAS_URI"] = url
|
| 82 |
|
| 83 |
logger = get_logger(__name__)
|
| 84 |
|