rvritesh167 commited on
Commit
6800956
1 Parent(s): 27dbf74

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -9
app.py CHANGED
@@ -1,9 +1,7 @@
1
  import streamlit as st
2
  import tempfile
3
  import os
4
- # import pyperclip
5
  from langchain.document_loaders import UnstructuredFileLoader
6
- from clipboard import copy
7
 
8
 
9
 
@@ -15,24 +13,21 @@ def main():
15
  if uploaded_file is not None:
16
  st.subheader("PDF Content:")
17
  st.text("Extracted using langchain:")
18
-
19
  temp_file_path = os.path.join(tempfile.gettempdir(), f"{uploaded_file.name}")
20
  with open(temp_file_path, "wb") as temp_file:
21
  temp_file.write(uploaded_file.read())
22
-
23
  loader = UnstructuredFileLoader(temp_file_path)
24
  data = loader.load()
25
  txt = ''
26
  for item in data:
27
  txt += item.page_content
28
  text_content = txt
29
- if st.button("Copy to Clipboard"):
30
- copy(text_content)
31
- st.success("Text copied to clipboard!")
32
  st.text_area("Extracted Text:", value=text_content, height=300)
33
 
34
-
35
- st.text_input("Copy this text:", value=text_content, key="copy_text")
36
 
37
 
38
 
 
1
  import streamlit as st
2
  import tempfile
3
  import os
 
4
  from langchain.document_loaders import UnstructuredFileLoader
 
5
 
6
 
7
 
 
13
  if uploaded_file is not None:
14
  st.subheader("PDF Content:")
15
  st.text("Extracted using langchain:")
 
16
  temp_file_path = os.path.join(tempfile.gettempdir(), f"{uploaded_file.name}")
17
  with open(temp_file_path, "wb") as temp_file:
18
  temp_file.write(uploaded_file.read())
 
19
  loader = UnstructuredFileLoader(temp_file_path)
20
  data = loader.load()
21
  txt = ''
22
  for item in data:
23
  txt += item.page_content
24
  text_content = txt
25
+ # if st.button("Copy to Clipboard"):
26
+ # copy(text_content)
27
+ # st.success("Text copied to clipboard!")
28
  st.text_area("Extracted Text:", value=text_content, height=300)
29
 
30
+ # st.text_input("Copy this text:", value=text_content, key="copy_text")
 
31
 
32
 
33