Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -40,7 +40,6 @@ def read_pdf(file_path):
|
|
40 |
pages = loader.load_and_split()
|
41 |
text = ""
|
42 |
for page in pages:
|
43 |
-
print(page.page_content)
|
44 |
text = text + " "+page.page_content+ "\n\n"
|
45 |
return text
|
46 |
def generate_pdf_from_markup(markup_text):
|
@@ -103,8 +102,12 @@ def handle_pdf(file_path):
|
|
103 |
st.write(formatted_data)
|
104 |
|
105 |
pdf_path = ""
|
|
|
106 |
|
107 |
-
|
|
|
|
|
|
|
108 |
# Add spinner while generating the PDF
|
109 |
with st.spinner("Generating PDF..."):
|
110 |
# Generate the PDF from markup text
|
@@ -121,7 +124,7 @@ def handle_pdf(file_path):
|
|
121 |
file_name="generated.pdf",
|
122 |
mime="application/pdf"
|
123 |
)
|
124 |
-
|
125 |
def main():
|
126 |
st.title("Resume Parser")
|
127 |
option = st.radio(
|
@@ -144,34 +147,7 @@ def main():
|
|
144 |
|
145 |
st.success(f"File saved at {original_file_path}")
|
146 |
|
147 |
-
handle_pdf(original_file_path)
|
148 |
-
|
149 |
-
|
150 |
-
# with st.spinner("Parsing Resume..."):
|
151 |
-
# data = read_pdf(original_file_path)
|
152 |
-
# modified_data = parse_resume(data)
|
153 |
-
# formatted_data = format_string(modified_data["text"])
|
154 |
-
# st.write(formatted_data)
|
155 |
-
# pdf_path = ""
|
156 |
-
|
157 |
-
# if st.button("Generate PDF"):
|
158 |
-
# # Add spinner while generating the PDF
|
159 |
-
# with st.spinner("Generating PDF..."):
|
160 |
-
# # Generate the PDF from markup text
|
161 |
-
# pdf_path = generate_pdf_from_markup(formatted_data)
|
162 |
-
|
163 |
-
# st.success("PDF generated successfully.")
|
164 |
-
|
165 |
-
# # Show the preview of the first page of the PDF
|
166 |
-
# with open(pdf_path, "rb") as f:
|
167 |
-
# pdf_bytes = f.read()
|
168 |
-
# st.download_button(
|
169 |
-
# label="Download PDF",
|
170 |
-
# data=pdf_bytes,
|
171 |
-
# file_name="generated.pdf",
|
172 |
-
# mime="application/pdf"
|
173 |
-
# )
|
174 |
-
|
175 |
|
176 |
if __name__ == "__main__":
|
177 |
-
main()
|
|
|
40 |
pages = loader.load_and_split()
|
41 |
text = ""
|
42 |
for page in pages:
|
|
|
43 |
text = text + " "+page.page_content+ "\n\n"
|
44 |
return text
|
45 |
def generate_pdf_from_markup(markup_text):
|
|
|
102 |
st.write(formatted_data)
|
103 |
|
104 |
pdf_path = ""
|
105 |
+
print("Formatted text generated")
|
106 |
|
107 |
+
print(formatted_data)
|
108 |
+
if formatted_data:
|
109 |
+
# if st.button("Generate PDF"):
|
110 |
+
print("Button Clicked")
|
111 |
# Add spinner while generating the PDF
|
112 |
with st.spinner("Generating PDF..."):
|
113 |
# Generate the PDF from markup text
|
|
|
124 |
file_name="generated.pdf",
|
125 |
mime="application/pdf"
|
126 |
)
|
127 |
+
print("AT LAST")
|
128 |
def main():
|
129 |
st.title("Resume Parser")
|
130 |
option = st.radio(
|
|
|
147 |
|
148 |
st.success(f"File saved at {original_file_path}")
|
149 |
|
150 |
+
handle_pdf(original_file_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
|
152 |
if __name__ == "__main__":
|
153 |
+
main()
|