Spaces:
Sleeping
Sleeping
APPLE commited on
Commit ·
e096ffd
1
Parent(s): 1712bce
poetry
Browse files
app.py
CHANGED
|
@@ -1,31 +1,25 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import os
|
| 3 |
|
| 4 |
-
|
| 5 |
-
st.write("Cloning the repository...")
|
| 6 |
-
os.system(f"git clone {repo_url}")
|
| 7 |
-
|
| 8 |
-
def install_dependencies():
|
| 9 |
-
st.write("Installing dependencies using Poetry...")
|
| 10 |
-
os.chdir("form16-parser")
|
| 11 |
-
os.system("python -m pip install poetry")
|
| 12 |
-
os.system("python -m poetry install")
|
| 13 |
-
os.system("python -m poetry shell")
|
| 14 |
|
| 15 |
def main():
|
| 16 |
-
st.title("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
|
|
|
| 20 |
|
| 21 |
-
|
| 22 |
-
if st.button("Clone Repo and Install Dependencies"):
|
| 23 |
-
clone_repo(repo_url)
|
| 24 |
-
install_dependencies()
|
| 25 |
-
st.write("Dependencies installed successfully!")
|
| 26 |
|
| 27 |
-
|
| 28 |
-
st.write(f"{build_parser}")
|
| 29 |
|
| 30 |
if __name__ == "__main__":
|
| 31 |
main()
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import os
|
| 3 |
|
| 4 |
+
from form16_parser import build_parser
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
def main():
|
| 7 |
+
st.title("Form16 Parser")
|
| 8 |
+
|
| 9 |
+
uploaded_file = st.file_uploader("Upload a PDF file", type="pdf")
|
| 10 |
+
|
| 11 |
+
if uploaded_file is not None:
|
| 12 |
+
# Save the uploaded file to a temporary directory
|
| 13 |
+
with open(os.path.join("temp_files", uploaded_file.name), "wb") as f:
|
| 14 |
+
f.write(uploaded_file.getvalue())
|
| 15 |
|
| 16 |
+
filepath = os.path.join("temp_files", uploaded_file.name)
|
| 17 |
+
parser = build_parser()
|
| 18 |
+
parsed = parser.parse(filepath, return_output=True)
|
| 19 |
|
| 20 |
+
st.write(parsed)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
+
|
|
|
|
| 23 |
|
| 24 |
if __name__ == "__main__":
|
| 25 |
main()
|