Spaces:
Runtime error
Runtime error
Commit
·
b90e071
1
Parent(s):
94e6e84
Changed code for pdf preview
Browse files
app.py
CHANGED
@@ -97,10 +97,11 @@ def displayPDF(file,file_name):
|
|
97 |
base64_pdf = base64.b64encode(f.read()).decode('utf-8')
|
98 |
|
99 |
# Embedding PDF in HTML
|
100 |
-
# pdf_display = f'<iframe src="data:application/pdf;base64,{base64_pdf}" width="700" height="
|
|
|
101 |
# st.write()
|
102 |
# pdf_display = f'<embed src="http://localhost:8900/{file_name}" width="700" height="1000" type="application/pdf"></embed>'
|
103 |
-
pdf_display = f'<iframe src="http://localhost:8900/{file_name}" width="700" height="900" type="application/pdf"></iframe>'
|
104 |
|
105 |
|
106 |
# st.write(pdf_display)
|
@@ -137,9 +138,9 @@ def main():
|
|
137 |
"size" : uploaded_file.size
|
138 |
}
|
139 |
print(os.getcwd())
|
140 |
-
st.write(os.getcwd())
|
141 |
cwd = os.getcwd()
|
142 |
-
st.write(os.listdir(cwd))
|
143 |
filepath = cwd+"/uploaded/"+uploaded_file.name
|
144 |
with open(filepath, "wb") as temp_file:
|
145 |
temp_file.write(uploaded_file.read())
|
@@ -183,7 +184,7 @@ def main():
|
|
183 |
st.session_state["past"].append(user_input)
|
184 |
response = answer
|
185 |
st.session_state["generated"].append(response)
|
186 |
-
st.write(st.session_state)
|
187 |
# user_input = st.text_input(label="Message",key="input")
|
188 |
|
189 |
# Display Conversation history using Streamlit messages
|
|
|
97 |
base64_pdf = base64.b64encode(f.read()).decode('utf-8')
|
98 |
|
99 |
# Embedding PDF in HTML
|
100 |
+
# pdf_display = f'<iframe src="data:application/pdf;base64,{base64_pdf}" width="700" height="900" type="application/pdf"></iframe>'
|
101 |
+
pdf_display = f'<iframe src="{base64_pdf}" width="700" height="900" type="application/pdf"></iframe>'
|
102 |
# st.write()
|
103 |
# pdf_display = f'<embed src="http://localhost:8900/{file_name}" width="700" height="1000" type="application/pdf"></embed>'
|
104 |
+
# pdf_display = f'<iframe src="http://localhost:8900/{file_name}" width="700" height="900" type="application/pdf"></iframe>'
|
105 |
|
106 |
|
107 |
# st.write(pdf_display)
|
|
|
138 |
"size" : uploaded_file.size
|
139 |
}
|
140 |
print(os.getcwd())
|
141 |
+
# st.write(os.getcwd())
|
142 |
cwd = os.getcwd()
|
143 |
+
# st.write(os.listdir(cwd))
|
144 |
filepath = cwd+"/uploaded/"+uploaded_file.name
|
145 |
with open(filepath, "wb") as temp_file:
|
146 |
temp_file.write(uploaded_file.read())
|
|
|
184 |
st.session_state["past"].append(user_input)
|
185 |
response = answer
|
186 |
st.session_state["generated"].append(response)
|
187 |
+
# st.write(st.session_state)
|
188 |
# user_input = st.text_input(label="Message",key="input")
|
189 |
|
190 |
# Display Conversation history using Streamlit messages
|