Spaces:
Runtime error
Runtime error
Commit
·
d9a2140
1
Parent(s):
b685471
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,16 +1,11 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import tempfile
|
| 3 |
import os
|
| 4 |
-
import pyperclip
|
| 5 |
from langchain.document_loaders import UnstructuredFileLoader
|
| 6 |
-
|
|
|
|
| 7 |
|
| 8 |
-
def copy_to_clipboard(text):
|
| 9 |
-
root = tk.Tk()
|
| 10 |
-
root.withdraw() # Hide the main window
|
| 11 |
-
root.clipboard_clear()
|
| 12 |
-
root.clipboard_append(text)
|
| 13 |
-
root.update()
|
| 14 |
|
| 15 |
def main():
|
| 16 |
st.title("PDF Text Extractor")
|
|
@@ -32,7 +27,7 @@ def main():
|
|
| 32 |
txt += item.page_content
|
| 33 |
text_content = txt
|
| 34 |
if st.button("Copy to Clipboard"):
|
| 35 |
-
|
| 36 |
st.success("Text copied to clipboard!")
|
| 37 |
st.text_area("Extracted Text:", value=text_content, height=300)
|
| 38 |
|
|
|
|
| 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 |
|
| 10 |
def main():
|
| 11 |
st.title("PDF Text Extractor")
|
|
|
|
| 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 |
|