code: # Importing necessary library
  import streamlit as st
  
  
  # Setting up the page configuration
  st.set_page_config(
      page_title="QuickDigest AI",
      page_icon=":brain:",
      layout="wide",
      initial_sidebar_state="expanded"
  )
  
  # Defining the function to display the home page
  def home():
      import streamlit as st
      from streamlit_extras.badges import badge
      from streamlit_extras.colored_header import colored_header
      from streamlit_extras.let_it_rain import rain
  
      # Displaying a rain animation with specified parameters
      rain(
          emoji="🎈",
          font_size=54,
          falling_speed=5,
          animation_length="1",
      )
      
      # Displaying a colored header with specified parameters
      colored_header(
          label="QuickDigest AI🧠, Your Intelligent Data Companion",
          description="~ Powered by OpenAI, Llamaindex, AssemblyAI, Langchain, Replicate, Clipdrop",
          color_name="violet-70",
      )
  
      # Displaying information and warnings in the sidebar
      st.sidebar.info(
          "Visit [OpenAI Pricing](https://openai.com/pricing#language-models) to get an overview of costs incurring depending upon the model chosen."
      )
      st.sidebar.info(
          "For key & data privacy concerns, We do not store your Key, it will be removed after your session ends. Also OpenAI will not use data submitted by customers via our API to train or improve our models, unless you explicitly decide to share your data with us for this purpose, For more info please visit [OpenAI FAQs](https://help.openai.com/en/articles/7039943-data-usage-for-consumer-services-faq)."
      )
      st.sidebar.warning(
          "LLMs may produce inaccurate information about people, places, or facts. Don't entirely trust them."
      )
      
      # Displaying markdown text on the page
      st.markdown(
          "<h6>Discover a new horizon of data interaction with QuickDigest AI, your intelligent companion in navigating through diverse data formats. QuickDigest AI is meticulously crafted to simplify and enrich your engagement with data, ensuring a seamless flow of insights right at your fingertips.</h6>",
          unsafe_allow_html=True
      )
      st.markdown(
          "**Effortless Data Extraction and Interaction:** QuickDigest AI stands as a beacon of innovation, allowing users to upload and interact with a variety of file formats including PDFs, Word documents, text files, and even audio/video files. The platform's cutting-edge technology ensures a smooth extraction of data, paving the way for meaningful conversations with the information gleaned from these files."
      )
      st.markdown(
          "**Engage with your Datasets:** Dive into datasets like never before. QuickDigest AI invites you to upload your dataset and engage in a dialogue with it. Our advanced AI algorithms facilitate a conversational interaction with your dataset, making the extraction of insights an intuitive and enriching experience."
      )
      st.markdown(
          "**Real-Time Web Search:** One of the limitations of large language models is there limited knowledge. QuickDigest AI's real-time web search feature ensures you're always ahead with the latest information. Be it market trends, news updates, or the newest research findings, QuickDigest AI brings the world to you in real-time."
      )
      st.markdown(
          "**Ignite Your Creative Spark:** For product creators, QuickDigest AI unveils a realm of possibilities. Bored of simple product images, The Product Advertising Image Creator is your tool to craft captivating advertising images that resonate with your audience. Additionally, the Image Generator feature is your canvas to bring your creative visions to life, creating visually appealing images that speak volumes."
      )
  
      st.markdown("---")
      
      # Displaying a support section with badges and link button
      st.markdown("<h5>Support Us</h5>", unsafe_allow_html=True)
      col1, col2, col3, col4 = st.columns(4)
      with col1:
          st.write("Star this repository on Github")
          badge(type="github", name="codingis4noobs2/QuickDigest")
      with col2:
          st.write("Follow me on twitter")
          badge(type="twitter", name="4gameparth")
      with col3:
          st.write("Buy me a coffee")
          badge(type="buymeacoffee", name="codingis4noobs2")
      with col4:
          st.link_button("Upvote on Replit", "https://replit.com/@ParthShah38/QuickDigestAI?v=1")
  
  
  # Function to display chat with files page
  def chat_with_files():
      import os
      import streamlit as st
      from streamlit_extras.badges import badge
      from streamlit_extras.colored_header import colored_header
      from llama_index import (
          OpenAIEmbedding,
          ServiceContext,
          set_global_service_context,
      )
      from llama_index.llms import OpenAI
      from llama_index.chat_engine.types import StreamingAgentChatResponse
      from llama_index import SimpleDirectoryReader, VectorStoreIndex
      import assemblyai as aai
      from PyPDF2 import PdfReader
      from docx import Document
  
      # Cache the result to avoid recomputation
      @st.cache_resource(show_spinner="Indexing documents...Please have patience")
      def build_index(files):
          documents = SimpleDirectoryReader(input_files=files).load_data()
          index = VectorStoreIndex.from_documents(documents)
          return index
  
      # Handle streaming responses
      def handle_stream(root, stream: StreamingAgentChatResponse):
          text = ""
          root.markdown("Thinking...")
          for token in stream.response_gen:
              text += token
              root.markdown(text)
          return text
  
      # Define constants and settings
      CACHE_DIR = "./uploads"
      aai.settings.api_key = st.secrets['assembly_api_key']
  
      # Render chat messages
      def render_message(message):
          with st.chat_message(message["role"]):
              st.write(message["text"])
  
      # Transcribe audio and video files
      def transcribe_audio_video(file_path):
          transcriber = aai.Transcriber()
          transcript = transcriber.transcribe(file_path)
          transcript_path = file_path + ".txt"
          with open(transcript_path, "w") as f:
              f.write(transcript.text)
          return transcript_path
  
      # Upload files and cache them
      def upload_files(types=["pdf", "txt", "mp3", "mp4", 'mpeg', 'doc', 'docx'], **kwargs):
          files = st.file_uploader(
              label=f"Upload files", type=types, **kwargs
          )
          if not files:
              st.info(f"Please add documents, Note: Scanned documents are not supported yet!")
              st.stop()
          return cache_files(files, types=types)
  
      # Cache uploaded files
      def cache_files(files, types=["pdf", "txt", "mp3", "mp4", 'mpeg', 'doc', 'docx']) -> list[str]:
          filepaths = []
          for file in files:
              # Determine the file extension from the mime type
              ext = file.type.split("/")[-1]
              if ext == "plain":  # Handle text/plain mime type
                  ext = "txt"
              elif ext in ["vnd.openxmlformats-officedocument.wordprocessingml.document", "vnd.ms-word"]:
                  ext = "docx"  # or "doc" depending on your needs
              if ext not in types:
                  continue
              filepath = f"{CACHE_DIR}/{file.name}"
              with open(filepath, "wb") as f:
                  f.write(file.getvalue())
              if ext in ["mp3", "mp4"]:
                  filepath = transcribe_audio_video(filepath)
              filepaths.append(filepath)
          # st.sidebar.write("Uploaded files", filepaths)  # Debug statement
          with st.sidebar:
              with st.expander("Uploaded Files"):
                  filepaths_pretty = "\n".join(f"- {filepath}" for filepath in filepaths)
                  st.markdown(f"{filepaths_pretty}")
          return filepaths
  
      def transcribe_and_save(file_path):
          transcriber = aai.Transcriber()
          transcript = transcriber.transcribe(file_path)
          transcript_path = file_path + ".txt"
          with open(transcript_path, "w") as f:
              f.write(transcript.text)
          return transcript_path
  
      # Save extracted text to a txt file
      def save_extracted_text_to_txt(text, filename):
          txt_filename = os.path.splitext(filename)[0] + ".txt"
          txt_filepath = os.path.join('uploads', txt_filename)
          with open(txt_filepath, 'w', encoding='utf-8') as txt_file:
              txt_file.write(text)
          return txt_filepath
  
      # Get OpenAI API key from session state
      def get_key():
          return st.session_state["openai_api_key"]
  
      # Read text from Word document
      def read_word_file(file_path):
          doc = Document(file_path)
          full_text = []
          for para in doc.paragraphs:
              full_text.append(para.text)
          return '\n'.join(full_text)
  
      # Process uploaded documents
      def process_documents(documents):
          processed_docs = []
          for doc in documents:
              if doc.endswith('.pdf'):
                  processed_docs.append(process_pdf(doc))
              elif doc.endswith(('.doc', '.docx')):
                  text = read_word_file(doc)
                  txt_filepath = save_extracted_text_to_txt(text, os.path.basename(doc))
                  processed_docs.append(txt_filepath)
              elif doc.endswith(('.mp3', '.mp4', '.mpeg')):
                  processed_docs.append(transcribe_and_save(doc))
              else:
                  processed_docs.append(doc)
          return processed_docs
  
      # Process PDF files
      def process_pdf(pdf_path):
          reader = PdfReader(pdf_path)
          all_text = ""
          for page in reader.pages:
              extracted_text = page.extract_text()
              if extracted_text:
                  processed_text = ' '.join(extracted_text.split('\n'))
                  all_text += processed_text + "\n\n"
          txt_filepath = save_extracted_text_to_txt(all_text, os.path.basename(pdf_path))
          os.remove(pdf_path)  # Delete the original PDF file
          return txt_filepath
  
      # Main logic for handling OpenAI API key and document processing
      if "openai_api_key" not in st.session_state:
          openai_api_key = st.sidebar.text_input("OpenAI API Key", type="password")
          if not openai_api_key:
              st.sidebar.warning("Please add your OpenAI API key to continue!!")
              st.warning("Please add your OpenAI API key to continue!!")
              st.sidebar.info("To obtain your OpenAI API key, please visit [OpenAI](https://platform.openai.com/account/api-keys). They provide a $5 credit to allow you to experiment with their models. If you're unsure about how to get the API key, you can follow this [Tutorial](https://www.maisieai.com/help/how-to-get-an-openai-api-key-for-chatgpt). While obtaining the API key doesn't require a compulsory payment, once your allotted credit is exhausted, a payment will be necessary to continue using their services.")
              st.stop()
          st.session_state["openai_api_key"] = openai_api_key
  
      st.sidebar.text_input("Enter Youtube Video ID(Coming soon)", disabled=True)
      st.sidebar.text_input("Enter Spotify Podast link(Coming soon)", disabled=True)
      
      openai_api_key = get_key()
  
      if openai_api_key:
          st.toast('OpenAI API Key Added ✅')
          # Define service-context
          with st.sidebar:
              with st.expander("Advanced Settings"):
                  st.session_state['temperature'] = st.number_input("Enter Temperature", help="It determines how creative the model should be", min_value=0.0,max_value=1.0, value=0.1)
          llm = OpenAI(temperature=st.session_state['temperature'], model='gpt-3.5-turbo', api_key=openai_api_key)
          embed_model = OpenAIEmbedding(api_key=openai_api_key)
          service_context = ServiceContext.from_defaults(llm=llm, embed_model=embed_model)
          set_global_service_context(service_context)
  
          # Upload PDFs, DOCs, TXTs, MP3s, and MP4s
          documents = upload_files(types=["pdf", "txt", "mp3", "mp4", 'mpeg', 'doc', 'docx'], accept_multiple_files=True)
  
          # Process the uploaded documents
          processed_documents = process_documents(documents)
  
          if not processed_documents:
              st.warning("No documents uploaded!")
              st.stop()
  
          index = build_index(processed_documents)
          query_engine = index.as_chat_engine(chat_mode="condense_question", streaming=True)
  
          messages = st.session_state.get("messages", [])
  
          if not messages:
              messages.append({"role": "assistant", "text": "Hi!"})
  
          for message in messages:
              render_message(message)
  
          if user_query := st.chat_input():
              message = {"role": "user", "text": user_query}
              messages.append(message)
              render_message(message)
  
              with st.chat_message("assistant"):
                  stream = query_engine.stream_chat(user_query)
                  text = handle_stream(st.empty(), stream)
                  message = {"role": "assistant", "text": text}
                  messages.append(message)
                  st.session_state.messages = messages
  
  
  # Function to use LLMs with web search
  def use_llms_with_web():
      from langchain.agents import ConversationalChatAgent, AgentExecutor
      from langchain.callbacks import StreamlitCallbackHandler
      from langchain.chat_models import ChatOpenAI
      from langchain.memory import ConversationBufferMemory
      from langchain.memory.chat_message_histories import StreamlitChatMessageHistory
      from langchain.tools import DuckDuckGoSearchRun
      import streamlit as st
  
  
      st.title("Use web search with LLMs")
      # Taking OpenAI API key input from the user
      openai_api_key = st.sidebar.text_input("OpenAI API Key", type="password")
      # Initializing message history and memory
      msgs = StreamlitChatMessageHistory()
      memory = ConversationBufferMemory(
          chat_memory=msgs, return_messages=True, memory_key="chat_history", output_key="output"
      )
      # Resetting chat history logic
      if len(msgs.messages) == 0 or st.sidebar.button("Reset chat history"):
          msgs.clear()
          msgs.add_ai_message("How can I help you?")
          st.session_state.steps = {}
  
      # Defining avatars for chat messages
      avatars = {"human": "user", "ai": "assistant"}
      for idx, msg in enumerate(msgs.messages):
          with st.chat_message(avatars[msg.type]):
              # Render intermediate steps if any were saved
              for step in st.session_state.steps.get(str(idx), []):
                  if step[0].tool == "_Exception":
                      continue
                  with st.status(f"**{step[0].tool}**: {step[0].tool_input}", state="complete"):
                      st.write(step[0].log)
                      st.write(step[1])
              st.write(msg.content)
  
      # Taking new input from the user
      if prompt := st.chat_input(placeholder="Who won the 2022 Cricket World Cup?"):
          st.chat_message("user").write(prompt)
          # Checking if OpenAI API key is provided
          if not openai_api_key:
              st.info("Please add your OpenAI API key to continue.")
              st.stop()
          # Initializing LLM and tools for web search
          llm = ChatOpenAI(model_name="gpt-3.5-turbo", openai_api_key=openai_api_key, streaming=True)
          tools = [DuckDuckGoSearchRun(name="Search")]
          chat_agent = ConversationalChatAgent.from_llm_and_tools(llm=llm, tools=tools)
  
          executor = AgentExecutor.from_agent_and_tools(
              agent=chat_agent,
              tools=tools,
              memory=memory,
              return_intermediate_steps=True,
              handle_parsing_errors=True,
          )
  
          with st.chat_message("assistant"):
              st_cb = StreamlitCallbackHandler(st.container(), expand_new_thoughts=False)
              response = executor(prompt, callbacks=[st_cb])
              st.write(response["output"])
              st.session_state.steps[str(len(msgs.messages) - 1)] = response["intermediate_steps"]
  
  
  # Function to display chat with dataset page
  def chat_with_dataset():
      from langchain.agents import AgentType
      from langchain.agents import create_pandas_dataframe_agent
      from langchain.callbacks import StreamlitCallbackHandler
      from langchain.chat_models import ChatOpenAI
      import streamlit as st
      import pandas as pd
      import os
  
  
      file_formats = {
          "csv": pd.read_csv,
          "xls": pd.read_excel,
          "xlsx": pd.read_excel,
          "xlsm": pd.read_excel,
          "xlsb": pd.read_excel,
      }
  
      def clear_submit():
          """
          Clear the Submit Button State
          Returns:
  
          """
          st.session_state["submit"] = False
  
      @st.cache_data()
      def load_data(uploaded_file):
          """
          Load data from the uploaded file based on its extension.
          """
          try:
              ext = os.path.splitext(uploaded_file.name)[1][1:].lower()
          except:
              ext = uploaded_file.split(".")[-1]
          if ext in file_formats:
              return file_formats[ext](uploaded_file)
          else:
              st.error(f"Unsupported file format: {ext}")
              return None
  
      st.title("Chat with your dataset")
      st.info("Asking one question at a time will result in a better output")
  
      uploaded_file = st.file_uploader(
          "Upload a Data file",
          type=list(file_formats.keys()),
          help="Various File formats are Support",
          on_change=clear_submit,
      )
  
      df = None  # Initialize df to None outside the if block
  
      if uploaded_file:
          df = load_data(uploaded_file)  # df will be assigned a value if uploaded_file is truthy
  
      if df is None:  # Check if df is still None before proceeding
          st.warning("No data file uploaded or there was an error in loading the data.")
          return  # Exit the function early if df is None
  
      openai_api_key = st.sidebar.text_input("OpenAI API Key", type="password")
      
      st.sidebar.info("If you face a KeyError: 'content' error, Press the clear conversation histroy button")
      if "messages" not in st.session_state or st.sidebar.button("Clear conversation history"):
          st.session_state["messages"] = [{"role": "assistant", "content": "How can I help you?"}]
      
      # Display previous chat messages
      for msg in st.session_state.messages:
          st.chat_message(msg["role"]).write(msg["content"])
  
      if prompt := st.chat_input(placeholder="What is this data about?"):
          st.session_state.messages.append({"role": "user", "content": prompt})
          st.chat_message("user").write(prompt)
          # Check if OpenAI API key is provided
          if not openai_api_key:
              st.info("Please add your OpenAI API key to continue.")
              st.stop()
  
          llm = ChatOpenAI(
              temperature=0, model="gpt-3.5-turbo-0613", openai_api_key=openai_api_key, streaming=True
          )
  
          pandas_df_agent = create_pandas_dataframe_agent(
              llm,
              df,
              verbose=True,
              agent_type=AgentType.OPENAI_FUNCTIONS,
              handle_parsing_errors=True,
          )
  
          with st.chat_message("assistant"):
              st_cb = StreamlitCallbackHandler(st.container(), expand_new_thoughts=False)
              response = pandas_df_agent.run(st.session_state.messages, callbacks=[st_cb])
              st.session_state.messages.append({"role": "assistant", "content": response})
              st.write(response)
  
  # Function to display transform products page
  def transform_products():
      import streamlit as st
      import requests
      import os
      import replicate
      import io
      from PIL import Image
  
      
      st.session_state['replicate_api_token'] = st.sidebar.text_input("Replicate API Token", type='password')
      os.environ['REPLICATE_API_TOKEN'] = st.session_state['replicate_api_token']
  
      if not st.session_state['replicate_api_token']:
          st.sidebar.warning('Please enter your Replicate API Token to continue!!')
          st.sidebar.info("You can get your Replicate API Token form here: [Replicate](https://replicate.com/account/api-tokens)")
          st.stop()
          
      if st.session_state['replicate_api_token']:
          st.info("This model works best with product images having transparent or plain backgrounds")
          # Prompt user to upload an image file
          img = st.file_uploader("Upload your product image", type=['png', 'jpg', 'jpeg'])
  
          if img is not None:
              has_plain_background = st.toggle("Does your product image have a plain or transparent background? If not, let us do the hard work for you!")
              prompt = st.text_input("Enter Prompt", help="Enter something you imagine...")
              negative_prompt = st.text_input("Enter Negative Prompt", help="Write what you don't want in the generated images")
              submit = st.button("Submit")
  
              if submit:
                  if has_plain_background:
                      # If image already has a plain background, prepare it for Replicate
                      image = Image.open(img)
                      bytes_obj = io.BytesIO()
                      image.save(bytes_obj, format='PNG')
                      bytes_obj.seek(0)
                  else:
                      # If image does not have a plain background, send it to ClipDrop to remove background
                      image_file_object = img.read()
                      r = requests.post('https://clipdrop-api.co/remove-background/v1',
                          files={
                              'image_file': ('uploaded_image.jpg', image_file_object, 'image/jpeg')
                          },
                          headers={'x-api-key': st.secrets['clipdrop_api_key']}
                      )
  
                      if r.ok:
                          # If background removal is successful, prepare image for Replicate
                          image = Image.open(io.BytesIO(r.content))
                          bytes_obj = io.BytesIO()
                          image.save(bytes_obj, format='PNG')
                          bytes_obj.seek(0)
                      else:
                          r.raise_for_status()
                          st.error('Failed to remove background. Try again.')
                          st.stop()
  
                  # Send image to Replicate for transformation
                  output = replicate.run(
                      "logerzhu/ad-inpaint:b1c17d148455c1fda435ababe9ab1e03bc0d917cc3cf4251916f22c45c83c7df",
                      input={"image_path": bytes_obj, "prompt": prompt, "image_num": 4}
                  )
                  col1, col2 = st.columns(2)
                  with col1:
                      st.image(output[1])
                      st.image(output[2])
                  with col2:
                      st.image(output[3])
                      st.image(output[4])
  
  # Function to generate images based on user input
  def generate_images():
      import streamlit as st
      import replicate
      import os
  
  
      st.session_state['replicate_api_token'] = st.sidebar.text_input("Replicate API Token", type='password')
      os.environ['REPLICATE_API_TOKEN'] = st.session_state['replicate_api_token']
  
      if not st.session_state['replicate_api_token']:
          st.sidebar.warning('Please enter your Replicate API Token to continue!!')
          st.sidebar.info("You can get your Replicate API Token form here: [Replicate](https://replicate.com/account/api-tokens)")
          st.stop()
  
      if st.session_state['replicate_api_token']:
          prompt = st.text_input(
              "Enter prompt", 
              help="Write something you can imagine..."
          )
          negative_prompt = st.text_input(
              "Enter Negative prompt", 
              help="Write what you don't want to see in the generated images"
          )
          submit = st.button("Submit")
  
          if submit:
              output = replicate.run(
                  "stability-ai/sdxl:8beff3369e81422112d93b89ca01426147de542cd4684c244b673b105188fe5f",
                  input={
                      "prompt": prompt, 
                      "negative_prompt": negative_prompt, 
                      "num_outputs": 4
                  },
              )
              col1, col2 = st.columns(2)
              with col1:
                  st.image(output[0])
                  st.image(output[2])
              with col2:
                  st.image(output[1])
                  st.image(output[3])
  
  # Dictonary to store all functions as pages
  page_names_to_funcs = {
      "Home 🏠": home,
      "Chat with files 📁": chat_with_files,
      "Chat with dataset 📖": chat_with_dataset,
      "Use web search with LLMs 🌐": use_llms_with_web,
      "Generate Images 🖌️": generate_images,
      "Transform your products 🎨": transform_products,
  }
  
  # display page by dictionary
  demo_name = st.sidebar.selectbox("Choose a page to navigate to", page_names_to_funcs.keys())
  page_names_to_funcs[demo_name]()
  
apis: langchain.agents.AgentExecutor.from_agent_and_tools langchain.chat_models.ChatOpenAI langchain.memory.chat_message_histories.StreamlitChatMessageHistory langchain.memory.ConversationBufferMemory langchain.agents.ConversationalChatAgent.from_llm_and_tools langchain.tools.DuckDuckGoSearchRun langchain.agents.create_pandas_dataframe_agent
extract_api: [((91, 213), 'streamlit.set_page_config', 'st.set_page_config', ([], {'page_title': '"""QuickDigest AI"""', 'page_icon': '""":brain:"""', 'layout': '"""wide"""', 'initial_sidebar_state': '"""expanded"""'}), "(page_title='QuickDigest AI', page_icon=':brain:', layout\n    ='wide', initial_sidebar_state='expanded')\n", (109, 213), True, 'import streamlit as st\n'), ((540, 608), 'streamlit_extras.let_it_rain.rain', 'rain', ([], {'emoji': '"""🎈"""', 'font_size': '(54)', 'falling_speed': '(5)', 'animation_length': '"""1"""'}), "(emoji='🎈', font_size=54, falling_speed=5, animation_length='1')\n", (544, 608), False, 'from streamlit_extras.let_it_rain import rain\n'), ((717, 918), 'streamlit_extras.colored_header.colored_header', 'colored_header', ([], {'label': '"""QuickDigest AI🧠, Your Intelligent Data Companion"""', 'description': '"""~ Powered by OpenAI, Llamaindex, AssemblyAI, Langchain, Replicate, Clipdrop"""', 'color_name': '"""violet-70"""'}), "(label='QuickDigest AI🧠, Your Intelligent Data Companion',\n    description=\n    '~ Powered by OpenAI, Llamaindex, AssemblyAI, Langchain, Replicate, Clipdrop'\n    , color_name='violet-70')\n", (731, 918), False, 'from streamlit_extras.colored_header import colored_header\n'), ((998, 1164), 'streamlit.sidebar.info', 'st.sidebar.info', (['"""Visit [OpenAI Pricing](https://openai.com/pricing#language-models) to get an overview of costs incurring depending upon the model chosen."""'], {}), "(\n    'Visit [OpenAI Pricing](https://openai.com/pricing#language-models) to get an overview of costs incurring depending upon the model chosen.'\n    )\n", (1013, 1164), True, 'import streamlit as st\n'), ((1173, 1599), 'streamlit.sidebar.info', 'st.sidebar.info', (['"""For key & data privacy concerns, We do not store your Key, it will be removed after your session ends. Also OpenAI will not use data submitted by customers via our API to train or improve our models, unless you explicitly decide to share your data with us for this purpose, For more info please visit [OpenAI FAQs](https://help.openai.com/en/articles/7039943-data-usage-for-consumer-services-faq)."""'], {}), "(\n    'For key & data privacy concerns, We do not store your Key, it will be removed after your session ends. Also OpenAI will not use data submitted by customers via our API to train or improve our models, unless you explicitly decide to share your data with us for this purpose, For more info please visit [OpenAI FAQs](https://help.openai.com/en/articles/7039943-data-usage-for-consumer-services-faq).'\n    )\n", (1188, 1599), True, 'import streamlit as st\n'), ((1608, 1738), 'streamlit.sidebar.warning', 'st.sidebar.warning', (['"""LLMs may produce inaccurate information about people, places, or facts. Don\'t entirely trust them."""'], {}), '(\n    "LLMs may produce inaccurate information about people, places, or facts. Don\'t entirely trust them."\n    )\n', (1626, 1738), True, 'import streamlit as st\n'), ((1795, 2139), 'streamlit.markdown', 'st.markdown', (['"""<h6>Discover a new horizon of data interaction with QuickDigest AI, your intelligent companion in navigating through diverse data formats. QuickDigest AI is meticulously crafted to simplify and enrich your engagement with data, ensuring a seamless flow of insights right at your fingertips.</h6>"""'], {'unsafe_allow_html': '(True)'}), "(\n    '<h6>Discover a new horizon of data interaction with QuickDigest AI, your intelligent companion in navigating through diverse data formats. QuickDigest AI is meticulously crafted to simplify and enrich your engagement with data, ensuring a seamless flow of insights right at your fingertips.</h6>'\n    , unsafe_allow_html=True)\n", (1806, 2139), True, 'import streamlit as st\n'), ((2156, 2585), 'streamlit.markdown', 'st.markdown', (['"""**Effortless Data Extraction and Interaction:** QuickDigest AI stands as a beacon of innovation, allowing users to upload and interact with a variety of file formats including PDFs, Word documents, text files, and even audio/video files. The platform\'s cutting-edge technology ensures a smooth extraction of data, paving the way for meaningful conversations with the information gleaned from these files."""'], {}), '(\n    "**Effortless Data Extraction and Interaction:** QuickDigest AI stands as a beacon of innovation, allowing users to upload and interact with a variety of file formats including PDFs, Word documents, text files, and even audio/video files. The platform\'s cutting-edge technology ensures a smooth extraction of data, paving the way for meaningful conversations with the information gleaned from these files."\n    )\n', (2167, 2585), True, 'import streamlit as st\n'), ((2594, 2930), 'streamlit.markdown', 'st.markdown', (['"""**Engage with your Datasets:** Dive into datasets like never before. QuickDigest AI invites you to upload your dataset and engage in a dialogue with it. Our advanced AI algorithms facilitate a conversational interaction with your dataset, making the extraction of insights an intuitive and enriching experience."""'], {}), "(\n    '**Engage with your Datasets:** Dive into datasets like never before. QuickDigest AI invites you to upload your dataset and engage in a dialogue with it. Our advanced AI algorithms facilitate a conversational interaction with your dataset, making the extraction of insights an intuitive and enriching experience.'\n    )\n", (2605, 2930), True, 'import streamlit as st\n'), ((2939, 3289), 'streamlit.markdown', 'st.markdown', (['"""**Real-Time Web Search:** One of the limitations of large language models is there limited knowledge. QuickDigest AI\'s real-time web search feature ensures you\'re always ahead with the latest information. Be it market trends, news updates, or the newest research findings, QuickDigest AI brings the world to you in real-time."""'], {}), '(\n    "**Real-Time Web Search:** One of the limitations of large language models is there limited knowledge. QuickDigest AI\'s real-time web search feature ensures you\'re always ahead with the latest information. Be it market trends, news updates, or the newest research findings, QuickDigest AI brings the world to you in real-time."\n    )\n', (2950, 3289), True, 'import streamlit as st\n'), ((3298, 3734), 'streamlit.markdown', 'st.markdown', (['"""**Ignite Your Creative Spark:** For product creators, QuickDigest AI unveils a realm of possibilities. Bored of simple product images, The Product Advertising Image Creator is your tool to craft captivating advertising images that resonate with your audience. Additionally, the Image Generator feature is your canvas to bring your creative visions to life, creating visually appealing images that speak volumes."""'], {}), "(\n    '**Ignite Your Creative Spark:** For product creators, QuickDigest AI unveils a realm of possibilities. Bored of simple product images, The Product Advertising Image Creator is your tool to craft captivating advertising images that resonate with your audience. Additionally, the Image Generator feature is your canvas to bring your creative visions to life, creating visually appealing images that speak volumes.'\n    )\n", (3309, 3734), True, 'import streamlit as st\n'), ((3744, 3762), 'streamlit.markdown', 'st.markdown', (['"""---"""'], {}), "('---')\n", (3755, 3762), True, 'import streamlit as st\n'), ((3835, 3893), 'streamlit.markdown', 'st.markdown', (['"""<h5>Support Us</h5>"""'], {'unsafe_allow_html': '(True)'}), "('<h5>Support Us</h5>', unsafe_allow_html=True)\n", (3846, 3893), True, 'import streamlit as st\n'), ((3923, 3936), 'streamlit.columns', 'st.columns', (['(4)'], {}), '(4)\n', (3933, 3936), True, 'import streamlit as st\n'), ((5058, 5133), 'streamlit.cache_resource', 'st.cache_resource', ([], {'show_spinner': '"""Indexing documents...Please have patience"""'}), "(show_spinner='Indexing documents...Please have patience')\n", (5075, 5133), True, 'import streamlit as st\n'), ((10968, 11043), 'streamlit.sidebar.text_input', 'st.sidebar.text_input', (['"""Enter Youtube Video ID(Coming soon)"""'], {'disabled': '(True)'}), "('Enter Youtube Video ID(Coming soon)', disabled=True)\n", (10989, 11043), True, 'import streamlit as st\n'), ((11048, 11126), 'streamlit.sidebar.text_input', 'st.sidebar.text_input', (['"""Enter Spotify Podast link(Coming soon)"""'], {'disabled': '(True)'}), "('Enter Spotify Podast link(Coming soon)', disabled=True)\n", (11069, 11126), True, 'import streamlit as st\n'), ((13550, 13586), 'streamlit.title', 'st.title', (['"""Use web search with LLMs"""'], {}), "('Use web search with LLMs')\n", (13558, 13586), True, 'import streamlit as st\n'), ((13656, 13712), 'streamlit.sidebar.text_input', 'st.sidebar.text_input', (['"""OpenAI API Key"""'], {'type': '"""password"""'}), "('OpenAI API Key', type='password')\n", (13677, 13712), True, 'import streamlit as st\n'), ((13770, 13799), 'langchain.memory.chat_message_histories.StreamlitChatMessageHistory', 'StreamlitChatMessageHistory', ([], {}), '()\n', (13797, 13799), False, 'from langchain.memory.chat_message_histories import StreamlitChatMessageHistory\n'), ((13813, 13930), 'langchain.memory.ConversationBufferMemory', 'ConversationBufferMemory', ([], {'chat_memory': 'msgs', 'return_messages': '(True)', 'memory_key': '"""chat_history"""', 'output_key': '"""output"""'}), "(chat_memory=msgs, return_messages=True, memory_key\n    ='chat_history', output_key='output')\n", (13837, 13930), False, 'from langchain.memory import ConversationBufferMemory\n'), ((16632, 16647), 'streamlit.cache_data', 'st.cache_data', ([], {}), '()\n', (16645, 16647), True, 'import streamlit as st\n'), ((17100, 17134), 'streamlit.title', 'st.title', (['"""Chat with your dataset"""'], {}), "('Chat with your dataset')\n", (17108, 17134), True, 'import streamlit as st\n'), ((17139, 17210), 'streamlit.info', 'st.info', (['"""Asking one question at a time will result in a better output"""'], {}), "('Asking one question at a time will result in a better output')\n", (17146, 17210), True, 'import streamlit as st\n'), ((17819, 17875), 'streamlit.sidebar.text_input', 'st.sidebar.text_input', (['"""OpenAI API Key"""'], {'type': '"""password"""'}), "('OpenAI API Key', type='password')\n", (17840, 17875), True, 'import streamlit as st\n'), ((17885, 17998), 'streamlit.sidebar.info', 'st.sidebar.info', (['"""If you face a KeyError: \'content\' error, Press the clear conversation histroy button"""'], {}), '(\n    "If you face a KeyError: \'content\' error, Press the clear conversation histroy button"\n    )\n', (17900, 17998), True, 'import streamlit as st\n'), ((19630, 19691), 'streamlit.sidebar.text_input', 'st.sidebar.text_input', (['"""Replicate API Token"""'], {'type': '"""password"""'}), "('Replicate API Token', type='password')\n", (19651, 19691), True, 'import streamlit as st\n'), ((22919, 22980), 'streamlit.sidebar.text_input', 'st.sidebar.text_input', (['"""Replicate API Token"""'], {'type': '"""password"""'}), "('Replicate API Token', type='password')\n", (22940, 22980), True, 'import streamlit as st\n'), ((3960, 4002), 'streamlit.write', 'st.write', (['"""Star this repository on Github"""'], {}), "('Star this repository on Github')\n", (3968, 4002), True, 'import streamlit as st\n'), ((4011, 4067), 'streamlit_extras.badges.badge', 'badge', ([], {'type': '"""github"""', 'name': '"""codingis4noobs2/QuickDigest"""'}), "(type='github', name='codingis4noobs2/QuickDigest')\n", (4016, 4067), False, 'from streamlit_extras.badges import badge\n'), ((4091, 4123), 'streamlit.write', 'st.write', (['"""Follow me on twitter"""'], {}), "('Follow me on twitter')\n", (4099, 4123), True, 'import streamlit as st\n'), ((4132, 4172), 'streamlit_extras.badges.badge', 'badge', ([], {'type': '"""twitter"""', 'name': '"""4gameparth"""'}), "(type='twitter', name='4gameparth')\n", (4137, 4172), False, 'from streamlit_extras.badges import badge\n'), ((4196, 4223), 'streamlit.write', 'st.write', (['"""Buy me a coffee"""'], {}), "('Buy me a coffee')\n", (4204, 4223), True, 'import streamlit as st\n'), ((4232, 4282), 'streamlit_extras.badges.badge', 'badge', ([], {'type': '"""buymeacoffee"""', 'name': '"""codingis4noobs2"""'}), "(type='buymeacoffee', name='codingis4noobs2')\n", (4237, 4282), False, 'from streamlit_extras.badges import badge\n'), ((4306, 4397), 'streamlit.link_button', 'st.link_button', (['"""Upvote on Replit"""', '"""https://replit.com/@ParthShah38/QuickDigestAI?v=1"""'], {}), "('Upvote on Replit',\n    'https://replit.com/@ParthShah38/QuickDigestAI?v=1')\n", (4320, 4397), True, 'import streamlit as st\n'), ((5251, 5293), 'llama_index.VectorStoreIndex.from_documents', 'VectorStoreIndex.from_documents', (['documents'], {}), '(documents)\n', (5282, 5293), False, 'from llama_index import SimpleDirectoryReader, VectorStoreIndex\n'), ((5963, 5980), 'assemblyai.Transcriber', 'aai.Transcriber', ([], {}), '()\n', (5978, 5980), True, 'import assemblyai as aai\n'), ((6337, 6398), 'streamlit.file_uploader', 'st.file_uploader', ([], {'label': 'f"""Upload files"""', 'type': 'types'}), "(label=f'Upload files', type=types, **kwargs)\n", (6353, 6398), True, 'import streamlit as st\n'), ((7852, 7869), 'assemblyai.Transcriber', 'aai.Transcriber', ([], {}), '()\n', (7867, 7869), True, 'import assemblyai as aai\n'), ((8262, 8299), 'os.path.join', 'os.path.join', (['"""uploads"""', 'txt_filename'], {}), "('uploads', txt_filename)\n", (8274, 8299), False, 'import os\n'), ((8628, 8647), 'docx.Document', 'Document', (['file_path'], {}), '(file_path)\n', (8636, 8647), False, 'from docx import Document\n'), ((9524, 9543), 'PyPDF2.PdfReader', 'PdfReader', (['pdf_path'], {}), '(pdf_path)\n', (9533, 9543), False, 'from PyPDF2 import PdfReader\n'), ((9898, 9917), 'os.remove', 'os.remove', (['pdf_path'], {}), '(pdf_path)\n', (9907, 9917), False, 'import os\n'), ((10122, 10178), 'streamlit.sidebar.text_input', 'st.sidebar.text_input', (['"""OpenAI API Key"""'], {'type': '"""password"""'}), "('OpenAI API Key', type='password')\n", (10143, 10178), True, 'import streamlit as st\n'), ((11195, 11229), 'streamlit.toast', 'st.toast', (['"""OpenAI API Key Added ✅"""'], {}), "('OpenAI API Key Added ✅')\n", (11203, 11229), True, 'import streamlit as st\n'), ((11535, 11637), 'llama_index.llms.OpenAI', 'OpenAI', ([], {'temperature': "st.session_state['temperature']", 'model': '"""gpt-3.5-turbo"""', 'api_key': 'openai_api_key'}), "(temperature=st.session_state['temperature'], model='gpt-3.5-turbo',\n    api_key=openai_api_key)\n", (11541, 11637), False, 'from llama_index.llms import OpenAI\n'), ((11656, 11695), 'llama_index.OpenAIEmbedding', 'OpenAIEmbedding', ([], {'api_key': 'openai_api_key'}), '(api_key=openai_api_key)\n', (11671, 11695), False, 'from llama_index import OpenAIEmbedding, ServiceContext, set_global_service_context\n'), ((11722, 11784), 'llama_index.ServiceContext.from_defaults', 'ServiceContext.from_defaults', ([], {'llm': 'llm', 'embed_model': 'embed_model'}), '(llm=llm, embed_model=embed_model)\n', (11750, 11784), False, 'from llama_index import OpenAIEmbedding, ServiceContext, set_global_service_context\n'), ((11793, 11836), 'llama_index.set_global_service_context', 'set_global_service_context', (['service_context'], {}), '(service_context)\n', (11819, 11836), False, 'from llama_index import OpenAIEmbedding, ServiceContext, set_global_service_context\n'), ((12378, 12414), 'streamlit.session_state.get', 'st.session_state.get', (['"""messages"""', '[]'], {}), "('messages', [])\n", (12398, 12414), True, 'import streamlit as st\n'), ((14009, 14048), 'streamlit.sidebar.button', 'st.sidebar.button', (['"""Reset chat history"""'], {}), "('Reset chat history')\n", (14026, 14048), True, 'import streamlit as st\n'), ((14812, 14876), 'streamlit.chat_input', 'st.chat_input', ([], {'placeholder': '"""Who won the 2022 Cricket World Cup?"""'}), "(placeholder='Who won the 2022 Cricket World Cup?')\n", (14825, 14876), True, 'import streamlit as st\n'), ((15159, 15248), 'langchain.chat_models.ChatOpenAI', 'ChatOpenAI', ([], {'model_name': '"""gpt-3.5-turbo"""', 'openai_api_key': 'openai_api_key', 'streaming': '(True)'}), "(model_name='gpt-3.5-turbo', openai_api_key=openai_api_key,\n    streaming=True)\n", (15169, 15248), False, 'from langchain.chat_models import ChatOpenAI\n'), ((15319, 15383), 'langchain.agents.ConversationalChatAgent.from_llm_and_tools', 'ConversationalChatAgent.from_llm_and_tools', ([], {'llm': 'llm', 'tools': 'tools'}), '(llm=llm, tools=tools)\n', (15361, 15383), False, 'from langchain.agents import ConversationalChatAgent, AgentExecutor\n'), ((15404, 15549), 'langchain.agents.AgentExecutor.from_agent_and_tools', 'AgentExecutor.from_agent_and_tools', ([], {'agent': 'chat_agent', 'tools': 'tools', 'memory': 'memory', 'return_intermediate_steps': '(True)', 'handle_parsing_errors': '(True)'}), '(agent=chat_agent, tools=tools, memory=\n    memory, return_intermediate_steps=True, handle_parsing_errors=True)\n', (15438, 15549), False, 'from langchain.agents import ConversationalChatAgent, AgentExecutor\n'), ((17662, 17740), 'streamlit.warning', 'st.warning', (['"""No data file uploaded or there was an error in loading the data."""'], {}), "('No data file uploaded or there was an error in loading the data.')\n", (17672, 17740), True, 'import streamlit as st\n'), ((18034, 18081), 'streamlit.sidebar.button', 'st.sidebar.button', (['"""Clear conversation history"""'], {}), "('Clear conversation history')\n", (18051, 18081), True, 'import streamlit as st\n'), ((18341, 18394), 'streamlit.chat_input', 'st.chat_input', ([], {'placeholder': '"""What is this data about?"""'}), "(placeholder='What is this data about?')\n", (18354, 18394), True, 'import streamlit as st\n'), ((18404, 18473), 'streamlit.session_state.messages.append', 'st.session_state.messages.append', (["{'role': 'user', 'content': prompt}"], {}), "({'role': 'user', 'content': prompt})\n", (18436, 18473), True, 'import streamlit as st\n'), ((18701, 18806), 'langchain.chat_models.ChatOpenAI', 'ChatOpenAI', ([], {'temperature': '(0)', 'model': '"""gpt-3.5-turbo-0613"""', 'openai_api_key': 'openai_api_key', 'streaming': '(True)'}), "(temperature=0, model='gpt-3.5-turbo-0613', openai_api_key=\n    openai_api_key, streaming=True)\n", (18711, 18806), False, 'from langchain.chat_models import ChatOpenAI\n'), ((18851, 18975), 'langchain.agents.create_pandas_dataframe_agent', 'create_pandas_dataframe_agent', (['llm', 'df'], {'verbose': '(True)', 'agent_type': 'AgentType.OPENAI_FUNCTIONS', 'handle_parsing_errors': '(True)'}), '(llm, df, verbose=True, agent_type=AgentType.\n    OPENAI_FUNCTIONS, handle_parsing_errors=True)\n', (18880, 18975), False, 'from langchain.agents import create_pandas_dataframe_agent\n'), ((19833, 19906), 'streamlit.sidebar.warning', 'st.sidebar.warning', (['"""Please enter your Replicate API Token to continue!!"""'], {}), "('Please enter your Replicate API Token to continue!!')\n", (19851, 19906), True, 'import streamlit as st\n'), ((19915, 20045), 'streamlit.sidebar.info', 'st.sidebar.info', (['"""You can get your Replicate API Token form here: [Replicate](https://replicate.com/account/api-tokens)"""'], {}), "(\n    'You can get your Replicate API Token form here: [Replicate](https://replicate.com/account/api-tokens)'\n    )\n", (19930, 20045), True, 'import streamlit as st\n'), ((20044, 20053), 'streamlit.stop', 'st.stop', ([], {}), '()\n', (20051, 20053), True, 'import streamlit as st\n'), ((20119, 20221), 'streamlit.info', 'st.info', (['"""This model works best with product images having transparent or plain backgrounds"""'], {}), "(\n    'This model works best with product images having transparent or plain backgrounds'\n    )\n", (20126, 20221), True, 'import streamlit as st\n'), ((20272, 20346), 'streamlit.file_uploader', 'st.file_uploader', (['"""Upload your product image"""'], {'type': "['png', 'jpg', 'jpeg']"}), "('Upload your product image', type=['png', 'jpg', 'jpeg'])\n", (20288, 20346), True, 'import streamlit as st\n'), ((23122, 23195), 'streamlit.sidebar.warning', 'st.sidebar.warning', (['"""Please enter your Replicate API Token to continue!!"""'], {}), "('Please enter your Replicate API Token to continue!!')\n", (23140, 23195), True, 'import streamlit as st\n'), ((23204, 23334), 'streamlit.sidebar.info', 'st.sidebar.info', (['"""You can get your Replicate API Token form here: [Replicate](https://replicate.com/account/api-tokens)"""'], {}), "(\n    'You can get your Replicate API Token form here: [Replicate](https://replicate.com/account/api-tokens)'\n    )\n", (23219, 23334), True, 'import streamlit as st\n'), ((23333, 23342), 'streamlit.stop', 'st.stop', ([], {}), '()\n', (23340, 23342), True, 'import streamlit as st\n'), ((23409, 23481), 'streamlit.text_input', 'st.text_input', (['"""Enter prompt"""'], {'help': '"""Write something you can imagine..."""'}), "('Enter prompt', help='Write something you can imagine...')\n", (23422, 23481), True, 'import streamlit as st\n'), ((23543, 23651), 'streamlit.text_input', 'st.text_input', (['"""Enter Negative prompt"""'], {'help': '"""Write what you don\'t want to see in the generated images"""'}), '(\'Enter Negative prompt\', help=\n    "Write what you don\'t want to see in the generated images")\n', (23556, 23651), True, 'import streamlit as st\n'), ((23699, 23718), 'streamlit.button', 'st.button', (['"""Submit"""'], {}), "('Submit')\n", (23708, 23718), True, 'import streamlit as st\n'), ((5786, 5818), 'streamlit.chat_message', 'st.chat_message', (["message['role']"], {}), "(message['role'])\n", (5801, 5818), True, 'import streamlit as st\n'), ((5832, 5857), 'streamlit.write', 'st.write', (["message['text']"], {}), "(message['text'])\n", (5840, 5857), True, 'import streamlit as st\n'), ((6455, 6540), 'streamlit.info', 'st.info', (['f"""Please add documents, Note: Scanned documents are not supported yet!"""'], {}), "(f'Please add documents, Note: Scanned documents are not supported yet!'\n    )\n", (6462, 6540), True, 'import streamlit as st\n'), ((6548, 6557), 'streamlit.stop', 'st.stop', ([], {}), '()\n', (6555, 6557), True, 'import streamlit as st\n'), ((9862, 9888), 'os.path.basename', 'os.path.basename', (['pdf_path'], {}), '(pdf_path)\n', (9878, 9888), False, 'import os\n'), ((10222, 10288), 'streamlit.sidebar.warning', 'st.sidebar.warning', (['"""Please add your OpenAI API key to continue!!"""'], {}), "('Please add your OpenAI API key to continue!!')\n", (10240, 10288), True, 'import streamlit as st\n'), ((10301, 10359), 'streamlit.warning', 'st.warning', (['"""Please add your OpenAI API key to continue!!"""'], {}), "('Please add your OpenAI API key to continue!!')\n", (10311, 10359), True, 'import streamlit as st\n'), ((10372, 10890), 'streamlit.sidebar.info', 'st.sidebar.info', (['"""To obtain your OpenAI API key, please visit [OpenAI](https://platform.openai.com/account/api-keys). They provide a $5 credit to allow you to experiment with their models. If you\'re unsure about how to get the API key, you can follow this [Tutorial](https://www.maisieai.com/help/how-to-get-an-openai-api-key-for-chatgpt). While obtaining the API key doesn\'t require a compulsory payment, once your allotted credit is exhausted, a payment will be necessary to continue using their services."""'], {}), '(\n    "To obtain your OpenAI API key, please visit [OpenAI](https://platform.openai.com/account/api-keys). They provide a $5 credit to allow you to experiment with their models. If you\'re unsure about how to get the API key, you can follow this [Tutorial](https://www.maisieai.com/help/how-to-get-an-openai-api-key-for-chatgpt). While obtaining the API key doesn\'t require a compulsory payment, once your allotted credit is exhausted, a payment will be necessary to continue using their services."\n    )\n', (10387, 10890), True, 'import streamlit as st\n'), ((10893, 10902), 'streamlit.stop', 'st.stop', ([], {}), '()\n', (10900, 10902), True, 'import streamlit as st\n'), ((12158, 12194), 'streamlit.warning', 'st.warning', (['"""No documents uploaded!"""'], {}), "('No documents uploaded!')\n", (12168, 12194), True, 'import streamlit as st\n'), ((12207, 12216), 'streamlit.stop', 'st.stop', ([], {}), '()\n', (12214, 12216), True, 'import streamlit as st\n'), ((12603, 12618), 'streamlit.chat_input', 'st.chat_input', ([], {}), '()\n', (12616, 12618), True, 'import streamlit as st\n'), ((14310, 14344), 'streamlit.chat_message', 'st.chat_message', (['avatars[msg.type]'], {}), '(avatars[msg.type])\n', (14325, 14344), True, 'import streamlit as st\n'), ((14735, 14756), 'streamlit.write', 'st.write', (['msg.content'], {}), '(msg.content)\n', (14743, 14756), True, 'import streamlit as st\n'), ((15016, 15070), 'streamlit.info', 'st.info', (['"""Please add your OpenAI API key to continue."""'], {}), "('Please add your OpenAI API key to continue.')\n", (15023, 15070), True, 'import streamlit as st\n'), ((15083, 15092), 'streamlit.stop', 'st.stop', ([], {}), '()\n', (15090, 15092), True, 'import streamlit as st\n'), ((15262, 15296), 'langchain.tools.DuckDuckGoSearchRun', 'DuckDuckGoSearchRun', ([], {'name': '"""Search"""'}), "(name='Search')\n", (15281, 15296), False, 'from langchain.tools import DuckDuckGoSearchRun\n'), ((15630, 15658), 'streamlit.chat_message', 'st.chat_message', (['"""assistant"""'], {}), "('assistant')\n", (15645, 15658), True, 'import streamlit as st\n'), ((15819, 15847), 'streamlit.write', 'st.write', (["response['output']"], {}), "(response['output'])\n", (15827, 15847), True, 'import streamlit as st\n'), ((17027, 17070), 'streamlit.error', 'st.error', (['f"""Unsupported file format: {ext}"""'], {}), "(f'Unsupported file format: {ext}')\n", (17035, 17070), True, 'import streamlit as st\n'), ((18609, 18663), 'streamlit.info', 'st.info', (['"""Please add your OpenAI API key to continue."""'], {}), "('Please add your OpenAI API key to continue.')\n", (18616, 18663), True, 'import streamlit as st\n'), ((18676, 18685), 'streamlit.stop', 'st.stop', ([], {}), '()\n', (18683, 18685), True, 'import streamlit as st\n'), ((19056, 19084), 'streamlit.chat_message', 'st.chat_message', (['"""assistant"""'], {}), "('assistant')\n", (19071, 19084), True, 'import streamlit as st\n'), ((19275, 19351), 'streamlit.session_state.messages.append', 'st.session_state.messages.append', (["{'role': 'assistant', 'content': response}"], {}), "({'role': 'assistant', 'content': response})\n", (19307, 19351), True, 'import streamlit as st\n'), ((19364, 19382), 'streamlit.write', 'st.write', (['response'], {}), '(response)\n', (19372, 19382), True, 'import streamlit as st\n'), ((20411, 20538), 'streamlit.toggle', 'st.toggle', (['"""Does your product image have a plain or transparent background? If not, let us do the hard work for you!"""'], {}), "(\n    'Does your product image have a plain or transparent background? If not, let us do the hard work for you!'\n    )\n", (20420, 20538), True, 'import streamlit as st\n'), ((20550, 20618), 'streamlit.text_input', 'st.text_input', (['"""Enter Prompt"""'], {'help': '"""Enter something you imagine..."""'}), "('Enter Prompt', help='Enter something you imagine...')\n", (20563, 20618), True, 'import streamlit as st\n'), ((20649, 20750), 'streamlit.text_input', 'st.text_input', (['"""Enter Negative Prompt"""'], {'help': '"""Write what you don\'t want in the generated images"""'}), '(\'Enter Negative Prompt\', help=\n    "Write what you don\'t want in the generated images")\n', (20662, 20750), True, 'import streamlit as st\n'), ((20767, 20786), 'streamlit.button', 'st.button', (['"""Submit"""'], {}), "('Submit')\n", (20776, 20786), True, 'import streamlit as st\n'), ((23760, 23953), 'replicate.run', 'replicate.run', (['"""stability-ai/sdxl:8beff3369e81422112d93b89ca01426147de542cd4684c244b673b105188fe5f"""'], {'input': "{'prompt': prompt, 'negative_prompt': negative_prompt, 'num_outputs': 4}"}), "(\n    'stability-ai/sdxl:8beff3369e81422112d93b89ca01426147de542cd4684c244b673b105188fe5f'\n    , input={'prompt': prompt, 'negative_prompt': negative_prompt,\n    'num_outputs': 4})\n", (23773, 23953), False, 'import replicate\n'), ((24092, 24105), 'streamlit.columns', 'st.columns', (['(2)'], {}), '(2)\n', (24102, 24105), True, 'import streamlit as st\n'), ((5182, 5222), 'llama_index.SimpleDirectoryReader', 'SimpleDirectoryReader', ([], {'input_files': 'files'}), '(input_files=files)\n', (5203, 5222), False, 'from llama_index import SimpleDirectoryReader, VectorStoreIndex\n'), ((7594, 7623), 'streamlit.expander', 'st.expander', (['"""Uploaded Files"""'], {}), "('Uploaded Files')\n", (7605, 7623), True, 'import streamlit as st\n'), ((7729, 7763), 'streamlit.markdown', 'st.markdown', (['f"""{filepaths_pretty}"""'], {}), "(f'{filepaths_pretty}')\n", (7740, 7763), True, 'import streamlit as st\n'), ((8200, 8226), 'os.path.splitext', 'os.path.splitext', (['filename'], {}), '(filename)\n', (8216, 8226), False, 'import os\n'), ((11305, 11337), 'streamlit.expander', 'st.expander', (['"""Advanced Settings"""'], {}), "('Advanced Settings')\n", (11316, 11337), True, 'import streamlit as st\n'), ((11389, 11530), 'streamlit.number_input', 'st.number_input', (['"""Enter Temperature"""'], {'help': '"""It determines how creative the model should be"""', 'min_value': '(0.0)', 'max_value': '(1.0)', 'value': '(0.1)'}), "('Enter Temperature', help=\n    'It determines how creative the model should be', min_value=0.0,\n    max_value=1.0, value=0.1)\n", (11404, 11530), True, 'import streamlit as st\n'), ((12770, 12798), 'streamlit.chat_message', 'st.chat_message', (['"""assistant"""'], {}), "('assistant')\n", (12785, 12798), True, 'import streamlit as st\n'), ((14886, 14909), 'streamlit.chat_message', 'st.chat_message', (['"""user"""'], {}), "('user')\n", (14901, 14909), True, 'import streamlit as st\n'), ((15705, 15719), 'streamlit.container', 'st.container', ([], {}), '()\n', (15717, 15719), True, 'import streamlit as st\n'), ((18272, 18300), 'streamlit.chat_message', 'st.chat_message', (["msg['role']"], {}), "(msg['role'])\n", (18287, 18300), True, 'import streamlit as st\n'), ((18482, 18505), 'streamlit.chat_message', 'st.chat_message', (['"""user"""'], {}), "('user')\n", (18497, 18505), True, 'import streamlit as st\n'), ((19131, 19145), 'streamlit.container', 'st.container', ([], {}), '()\n', (19143, 19145), True, 'import streamlit as st\n'), ((22251, 22429), 'replicate.run', 'replicate.run', (['"""logerzhu/ad-inpaint:b1c17d148455c1fda435ababe9ab1e03bc0d917cc3cf4251916f22c45c83c7df"""'], {'input': "{'image_path': bytes_obj, 'prompt': prompt, 'image_num': 4}"}), "(\n    'logerzhu/ad-inpaint:b1c17d148455c1fda435ababe9ab1e03bc0d917cc3cf4251916f22c45c83c7df'\n    , input={'image_path': bytes_obj, 'prompt': prompt, 'image_num': 4})\n", (22264, 22429), False, 'import replicate\n'), ((22507, 22520), 'streamlit.columns', 'st.columns', (['(2)'], {}), '(2)\n', (22517, 22520), True, 'import streamlit as st\n'), ((24145, 24164), 'streamlit.image', 'st.image', (['output[0]'], {}), '(output[0])\n', (24153, 24164), True, 'import streamlit as st\n'), ((24181, 24200), 'streamlit.image', 'st.image', (['output[2]'], {}), '(output[2])\n', (24189, 24200), True, 'import streamlit as st\n'), ((24240, 24259), 'streamlit.image', 'st.image', (['output[1]'], {}), '(output[1])\n', (24248, 24259), True, 'import streamlit as st\n'), ((24276, 24295), 'streamlit.image', 'st.image', (['output[3]'], {}), '(output[3])\n', (24284, 24295), True, 'import streamlit as st\n'), ((12899, 12909), 'streamlit.empty', 'st.empty', ([], {}), '()\n', (12907, 12909), True, 'import streamlit as st\n'), ((14569, 14641), 'streamlit.status', 'st.status', (['f"""**{step[0].tool}**: {step[0].tool_input}"""'], {'state': '"""complete"""'}), "(f'**{step[0].tool}**: {step[0].tool_input}', state='complete')\n", (14578, 14641), True, 'import streamlit as st\n'), ((14663, 14684), 'streamlit.write', 'st.write', (['step[0].log'], {}), '(step[0].log)\n', (14671, 14684), True, 'import streamlit as st\n'), ((14705, 14722), 'streamlit.write', 'st.write', (['step[1]'], {}), '(step[1])\n', (14713, 14722), True, 'import streamlit as st\n'), ((20968, 20983), 'PIL.Image.open', 'Image.open', (['img'], {}), '(img)\n', (20978, 20983), False, 'from PIL import Image\n'), ((21016, 21028), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (21026, 21028), False, 'import io\n'), ((21326, 21530), 'requests.post', 'requests.post', (['"""https://clipdrop-api.co/remove-background/v1"""'], {'files': "{'image_file': ('uploaded_image.jpg', image_file_object, 'image/jpeg')}", 'headers': "{'x-api-key': st.secrets['clipdrop_api_key']}"}), "('https://clipdrop-api.co/remove-background/v1', files={\n    'image_file': ('uploaded_image.jpg', image_file_object, 'image/jpeg')},\n    headers={'x-api-key': st.secrets['clipdrop_api_key']})\n", (21339, 21530), False, 'import requests\n'), ((22568, 22587), 'streamlit.image', 'st.image', (['output[1]'], {}), '(output[1])\n', (22576, 22587), True, 'import streamlit as st\n'), ((22608, 22627), 'streamlit.image', 'st.image', (['output[2]'], {}), '(output[2])\n', (22616, 22627), True, 'import streamlit as st\n'), ((22675, 22694), 'streamlit.image', 'st.image', (['output[3]'], {}), '(output[3])\n', (22683, 22694), True, 'import streamlit as st\n'), ((22715, 22734), 'streamlit.image', 'st.image', (['output[4]'], {}), '(output[4])\n', (22723, 22734), True, 'import streamlit as st\n'), ((9163, 9184), 'os.path.basename', 'os.path.basename', (['doc'], {}), '(doc)\n', (9179, 9184), False, 'import os\n'), ((21868, 21880), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (21878, 21880), False, 'import io\n'), ((22078, 22129), 'streamlit.error', 'st.error', (['"""Failed to remove background. Try again."""'], {}), "('Failed to remove background. Try again.')\n", (22086, 22129), True, 'import streamlit as st\n'), ((22154, 22163), 'streamlit.stop', 'st.stop', ([], {}), '()\n', (22161, 22163), True, 'import streamlit as st\n'), ((16802, 16838), 'os.path.splitext', 'os.path.splitext', (['uploaded_file.name'], {}), '(uploaded_file.name)\n', (16818, 16838), False, 'import os\n'), ((21809, 21830), 'io.BytesIO', 'io.BytesIO', (['r.content'], {}), '(r.content)\n', (21819, 21830), False, 'import io\n')]