eagle0504 commited on
Commit
6eb23fe
1 Parent(s): 7c1c2ae

display pdf omitted

Browse files
Files changed (2) hide show
  1. app.py +0 -3
  2. helper/utils.py +0 -26
app.py CHANGED
@@ -64,9 +64,6 @@ with st.sidebar:
64
  # Clear button
65
  clear_button = st.sidebar.button("Clear Conversation", key="clear")
66
 
67
- # Display pdf
68
- st.image(uploaded_files)
69
-
70
  # Credit
71
  current_year = current_year() # This will print the current year
72
  st.markdown(
 
64
  # Clear button
65
  clear_button = st.sidebar.button("Clear Conversation", key="clear")
66
 
 
 
 
67
  # Credit
68
  current_year = current_year() # This will print the current year
69
  st.markdown(
helper/utils.py CHANGED
@@ -1,9 +1,7 @@
1
  import os
2
  from typing import Any, Dict, List, Tuple, Union
3
 
4
- import base64
5
  from datetime import datetime
6
- import streamlit as st
7
  import numpy as np
8
  import pandas as pd
9
  import PyPDF2
@@ -54,30 +52,6 @@ def read_and_textify(
54
  return [text_list, sources_list]
55
 
56
 
57
- def displayPDF(file: str) -> None:
58
- """
59
- This function reads a PDF file, encodes it into base64 and then displays it on a Streamlit app using markdown.
60
-
61
- Parameters:
62
- - file (str): The file path to the PDF file that needs to be displayed.
63
-
64
- Returns:
65
- - None
66
- """
67
-
68
- # Opening file from file path
69
- with open(file, "rb") as f:
70
- # Encoding file content to base64
71
- base64_pdf = base64.b64encode(f.read()).decode('utf-8')
72
-
73
- # Embedding PDF in HTML with specific size and type
74
- pdf_display = F'<embed src="data:application/pdf;base64,{base64_pdf}" width="700" height="1000" type="application/pdf">'
75
-
76
- # Displaying File in Streamlit app by allowing unsafe HTML
77
- st.markdown(pdf_display, unsafe_allow_html=True)
78
-
79
-
80
-
81
  client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
82
 
83
 
 
1
  import os
2
  from typing import Any, Dict, List, Tuple, Union
3
 
 
4
  from datetime import datetime
 
5
  import numpy as np
6
  import pandas as pd
7
  import PyPDF2
 
52
  return [text_list, sources_list]
53
 
54
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
56
 
57