This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import streamlit as st | |
from langchain.utilities import SerpAPIWrapper | |
# Get SERP API key and the search query | |
st.subheader('LangChain Search') | |
serpapi_api_key = st.text_input("SERP API Key", type="password") | |
search_query = st.text_input("Search Query") | |
# If the 'Search' button is clicked | |
if st.button("Search"): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, streamlit as st | |
from langchain.document_loaders import GCSFileLoader | |
creds_file = st.file_uploader("Upload Google Cloud credentials file", type="json") | |
if creds_file is not None: | |
creds_contents = creds_file.read().decode("utf-8") | |
with open("temp_credentials.json", "w") as f: | |
f.write(creds_contents) | |
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "temp_credentials.json" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import validators, streamlit as st | |
from langchain.document_loaders import YoutubeLoader | |
url = st.text_input("YouTube URL") | |
if st.button("Load"): | |
try: | |
if not url.strip(): | |
st.error("Please enter a URL") | |
elif not validators.url(url): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import validators, streamlit as st | |
from langchain.document_loaders import UnstructuredURLLoader | |
url = st.text_input("Enter URL") | |
if st.button("Load"): | |
try: | |
if not url.strip(): | |
st.error("Please enter a URL") | |
elif not validators.url(url): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import streamlit as st | |
from langchain.text_splitter import CharacterTextSplitter | |
text_file = st.file_uploader("Upload text file", type="txt") | |
if text_file is not None: | |
text = text_file.read().decode("utf-8") | |
if st.button("Load"): | |
try: |