Spaces:
Running
Running
Commit
·
6507010
1
Parent(s):
711aa47
Fixing up User styles for deployment
Browse files
main.py
CHANGED
|
@@ -23,6 +23,8 @@ def process_resume(input_method, resume_text, pdf_file):
|
|
| 23 |
with open(pdf_file, "rb") as f:
|
| 24 |
file_bytes = f.read()
|
| 25 |
else:
|
|
|
|
|
|
|
| 26 |
file_bytes = pdf_file.read()
|
| 27 |
file_obj = io.BytesIO(file_bytes)
|
| 28 |
text = extract_text_from_pdf(file_obj)
|
|
@@ -77,7 +79,10 @@ div[role="radiogroup"] {
|
|
| 77 |
}
|
| 78 |
"""
|
| 79 |
|
| 80 |
-
|
|
|
|
|
|
|
|
|
|
| 81 |
with gr.Column(elem_classes="center"):
|
| 82 |
gr.Markdown('<div class="fire-effect">Resume Roaster</div>')
|
| 83 |
gr.Markdown("Upload your resume as a PDF (default) or paste the text to receive a humorous, professional roast!")
|
|
@@ -90,7 +95,7 @@ with gr.Blocks(css=css_custom) as demo:
|
|
| 90 |
output = gr.Textbox(label="Roast Result", lines=10)
|
| 91 |
submit_btn = gr.Button("Roast It!")
|
| 92 |
|
| 93 |
-
#
|
| 94 |
input_method.change(fn=toggle_inputs, inputs=input_method, outputs=[pdf_file, resume_text])
|
| 95 |
submit_btn.click(fn=process_resume, inputs=[input_method, resume_text, pdf_file], outputs=output)
|
| 96 |
|
|
|
|
| 23 |
with open(pdf_file, "rb") as f:
|
| 24 |
file_bytes = f.read()
|
| 25 |
else:
|
| 26 |
+
# Ensure the file pointer is at the beginning
|
| 27 |
+
pdf_file.seek(0)
|
| 28 |
file_bytes = pdf_file.read()
|
| 29 |
file_obj = io.BytesIO(file_bytes)
|
| 30 |
text = extract_text_from_pdf(file_obj)
|
|
|
|
| 79 |
}
|
| 80 |
"""
|
| 81 |
|
| 82 |
+
# Inject the CSS via the head parameter
|
| 83 |
+
head_injection = f"<style>{css_custom}</style>"
|
| 84 |
+
|
| 85 |
+
with gr.Blocks(head=head_injection) as demo:
|
| 86 |
with gr.Column(elem_classes="center"):
|
| 87 |
gr.Markdown('<div class="fire-effect">Resume Roaster</div>')
|
| 88 |
gr.Markdown("Upload your resume as a PDF (default) or paste the text to receive a humorous, professional roast!")
|
|
|
|
| 95 |
output = gr.Textbox(label="Roast Result", lines=10)
|
| 96 |
submit_btn = gr.Button("Roast It!")
|
| 97 |
|
| 98 |
+
# Adjust toggle outputs to match new order.
|
| 99 |
input_method.change(fn=toggle_inputs, inputs=input_method, outputs=[pdf_file, resume_text])
|
| 100 |
submit_btn.click(fn=process_resume, inputs=[input_method, resume_text, pdf_file], outputs=output)
|
| 101 |
|