From ce2ccb1fbc71de8089c80d2540af97722a49ac54 Mon Sep 17 00:00:00 2001 From: axel7083 <42176370+axel7083@users.noreply.github.com> Date: Mon, 12 Aug 2024 09:48:48 +0200 Subject: [PATCH 1/2] chore(summarizer): adding markdown type file input Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com> --- .../natural_language_processing/summarizer/app/summarizer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/natural_language_processing/summarizer/app/summarizer.py b/recipes/natural_language_processing/summarizer/app/summarizer.py index 0a359ed1..cae39f8c 100644 --- a/recipes/natural_language_processing/summarizer/app/summarizer.py +++ b/recipes/natural_language_processing/summarizer/app/summarizer.py @@ -86,7 +86,7 @@ def evaluate_summary(text, response): return score st.title("🔎 Summarizer") -file = st.file_uploader("Upload file",type=[".txt",".pdf"]) +file = st.file_uploader("Upload file",type=[".txt",".pdf", ".md"]) llm = ChatOpenAI(base_url=model_service, api_key="not required", From 4f0ecc8f6a3bc069a25e93cd516fe06dafb9329b Mon Sep 17 00:00:00 2001 From: axel7083 <42176370+axel7083@users.noreply.github.com> Date: Mon, 12 Aug 2024 10:15:37 +0200 Subject: [PATCH 2/2] fix: file type check Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com> --- .../natural_language_processing/summarizer/app/summarizer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/natural_language_processing/summarizer/app/summarizer.py b/recipes/natural_language_processing/summarizer/app/summarizer.py index cae39f8c..2bbb119e 100644 --- a/recipes/natural_language_processing/summarizer/app/summarizer.py +++ b/recipes/natural_language_processing/summarizer/app/summarizer.py @@ -74,7 +74,7 @@ def read_file(file): pages = loader.load() text = "".join([p.page_content for p in pages]) - if file_type == "text/plain": + if file_type in ["text/markdown", "text/plain"]: text = file.read().decode() return text