diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 76a35c6..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,12 +0,0 @@ -version: "3" -services: - ollama-container: - image: ollama/ollama - volumes: - - ./data/ollama:/root/.ollama - ports: - - "11434:11434" - gradio-app: - image: easy-web-summarizer - ports: - - "7860:7860" diff --git a/summerizer_concise.py b/summerizer_concise.py deleted file mode 100644 index 64d0133..0000000 --- a/summerizer_concise.py +++ /dev/null @@ -1,66 +0,0 @@ -import argparse - -from langchain.chains.llm import LLMChain -from langchain.prompts import PromptTemplate -from langchain_community.chat_models import ChatOllama -from langchain_community.document_loaders import WebBaseLoader - - -def setup_argparse(): - """Setup argparse to parse command line arguments.""" - parser = argparse.ArgumentParser( - description="Summarize a document from a given URL." - ) - parser.add_argument( - "-u", "--url", required=True, help="URL of the document to summarize" - ) - return parser.parse_args() - - -def load_document(url): - """Load document from the specified URL.""" - loader = WebBaseLoader(url) - return loader.load() - - -def setup_summarization_chain(): - """Setup the summarization chain with a prompt template and ChatOllama.""" - prompt_template = PromptTemplate( - template="""As a professional summarizer, create a concise and comprehensive summary of the provided text, be it an article, post, conversation, or passage, while adhering to these guidelines: - 1. Craft a summary that is detailed, thorough, in-depth, and complex, while maintaining clarity and conciseness. - - 2. Incorporate main ideas and essential information, eliminating extraneous language and focusing on critical aspects. - - 3. Rely strictly on the provided text, without including external information. - - 4. Format the summary in paragraph form for easy understanding. - - 5.Conclude your notes with [End of Notes, Message #X] to indicate completion, where "X" represents the total number of messages that I have sent. In other words, include a message counter where you start with #1 and add 1 to the message counter every time I send a message. - - By following this optimized prompt, you will generate an effective summary that encapsulates the essence of the given text in a clear, concise, and reader-friendly manner. - - Write a short concise summary of the following: - - "{text}" - - CONCISE SUMMARY:""", - input_variables=["text"], - ) - - llm = ChatOllama(model="llama2") - llm_chain = LLMChain(llm=llm, prompt=prompt_template) - return llm_chain - - -def main(): - args = setup_argparse() - docs = load_document(args.url) - - llm_chain = setup_summarization_chain() - result = llm_chain.run(docs) - - print(result) - - -if __name__ == "__main__": - main() diff --git a/webui_old.py b/webui_old.py deleted file mode 100644 index e7cc77b..0000000 --- a/webui_old.py +++ /dev/null @@ -1,21 +0,0 @@ -import gradio as gr - -from summarizer import load_document, setup_summarization_chain - - -def summarize(url): - docs = load_document(url) - llm_chain = setup_summarization_chain() - result = llm_chain.run(docs) - return result - - -iface = gr.Interface( - fn=summarize, - inputs="text", - outputs="text", - title="Summarizer", - description="Enter a URL to get a summary of the document.", -) - -iface.launch()