manasvinid commited on
Commit
b0df9c3
·
verified ·
1 Parent(s): 684558b

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +77 -0
app.py ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ import streamlit as st
3
+ import pandas as pd
4
+ import PyPDF2
5
+ import functions
6
+
7
+ def main():
8
+ st.title("PDF to CSV Converter")
9
+
10
+ # File uploader widget
11
+ uploaded_file = st.file_uploader("Upload PDF", type=["pdf"])
12
+
13
+ if uploaded_file is not None:
14
+ # Read PDF file
15
+ pdf_reader = PyPDF2.PdfFileReader(uploaded_file)
16
+ num_pages = pdf_reader.numPages
17
+
18
+ # Extract text from each page
19
+ text = ""
20
+ for page_num in range(num_pages):
21
+ page = pdf_reader.getPage(page_num)
22
+ text += page.extractText()
23
+
24
+ # Convert text to CSV
25
+ csv_data = convert_to_csv(text)
26
+
27
+ # Display or download CSV
28
+ st.subheader("Converted CSV Data")
29
+ st.write(csv_data)
30
+
31
+ # Download link for CSV file
32
+ st.download_button(
33
+ label="Download CSV",
34
+ data=csv_data,
35
+ file_name="converted_data.csv",
36
+ mime="text/csv"
37
+ )
38
+
39
+ def convert_to_csv(text):
40
+ # Split text into lines and create a DataFrame
41
+ lines = text.split("\n")
42
+ df = pd.DataFrame(lines, columns=["Text"])
43
+
44
+ # Convert DataFrame to CSV format
45
+ csv_data = df.to_csv(index=False)
46
+
47
+ return csv_data
48
+
49
+
50
+
51
+
52
+
53
+ backgroundPattern = """
54
+ <style>
55
+ [data-testid="stAppViewContainer"] {
56
+ background-color: #0E1117;
57
+ opacity: 1;
58
+ background-image: radial-gradient(#282C34 0.75px, #0E1117 0.75px);
59
+ background-size: 15px 15px;
60
+ }
61
+ </style>
62
+ """
63
+
64
+ st.markdown(backgroundPattern, unsafe_allow_html=True)
65
+
66
+ st.write("""
67
+ # Resume Screening & Classification
68
+ """)
69
+
70
+ tab3 = st.tabs(['Rank'])
71
+
72
+
73
+ with tab3:
74
+ st.header('Input')
75
+ if __name__ == "__main__":
76
+ uploadedJobDescriptionRnk= main()
77
+ uploadedResumeRnk= main()