Spaces:
Runtime error
Runtime error
Muhammad Salman Akbar
commited on
Commit
•
318f9b1
1
Parent(s):
014511c
Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ import re
|
|
4 |
import torch
|
5 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification, AutoModelForSeq2SeqLM
|
6 |
from groq import Groq
|
7 |
-
import
|
8 |
from docxtpl import DocxTemplate
|
9 |
from datetime import datetime
|
10 |
|
@@ -170,46 +170,29 @@ def generate_offer_letter(template_file, candidate_name, role, start_date, hours
|
|
170 |
# Return the file object
|
171 |
return open(docx_file_path, 'rb')
|
172 |
|
173 |
-
# ---
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
)
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
gr.Textbox(label="Start Date (YYYY-MM-DD)"), # Use Textbox for date
|
200 |
-
gr.Number(label="Hours per Week"),
|
201 |
-
],
|
202 |
-
outputs=gr.File(label="Offer Letter"), # Change to gr.File
|
203 |
-
title="Offer Letter Generator",
|
204 |
-
description="Upload an offer letter template and enter candidate information to generate an offer letter.",
|
205 |
-
)
|
206 |
-
|
207 |
-
# Combine the interfaces using a Tabbed interface
|
208 |
-
demo = gr.TabbedInterface(
|
209 |
-
[demo, offer_demo],
|
210 |
-
["Resume Analyzer", "Offer Letter Generator"],
|
211 |
-
title="HR Assistant",
|
212 |
-
)
|
213 |
-
|
214 |
-
if __name__ == '__main__':
|
215 |
-
demo.launch(share=True)
|
|
|
4 |
import torch
|
5 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification, AutoModelForSeq2SeqLM
|
6 |
from groq import Groq
|
7 |
+
import streamlit as st
|
8 |
from docxtpl import DocxTemplate
|
9 |
from datetime import datetime
|
10 |
|
|
|
170 |
# Return the file object
|
171 |
return open(docx_file_path, 'rb')
|
172 |
|
173 |
+
# --- Streamlit Interface ---
|
174 |
+
st.title("HR Assistant")
|
175 |
+
|
176 |
+
tab1, tab2 = st.tabs(["Resume Analyzer", "Offer Letter Generator"])
|
177 |
+
|
178 |
+
with tab1:
|
179 |
+
st.header("Resume and Job Description Analyzer")
|
180 |
+
resume_file = st.file_uploader("Upload Resume (PDF or TXT)", type=['pdf', 'txt'])
|
181 |
+
job_description_file = st.file_uploader("Upload Job Description (TXT)", type=['txt'])
|
182 |
+
|
183 |
+
if resume_file is not None and job_description_file is not None:
|
184 |
+
analysis_results = analyze_resume(resume_file, job_description_file)
|
185 |
+
for result in analysis_results:
|
186 |
+
st.markdown(result)
|
187 |
+
|
188 |
+
with tab2:
|
189 |
+
st.header("Offer Letter Generator")
|
190 |
+
template_file = st.file_uploader("Upload Offer Letter Template (DOCX)", type=['docx'])
|
191 |
+
candidate_name = st.text_input("Candidate Name")
|
192 |
+
role = st.text_input("Role")
|
193 |
+
start_date = st.text_input("Start Date (YYYY-MM-DD)")
|
194 |
+
hours = st.number_input("Hours per Week")
|
195 |
+
|
196 |
+
if template_file is not None and candidate_name and role and start_date and hours:
|
197 |
+
offer_letter = generate_offer_letter(template_file, candidate_name, role, start_date, hours)
|
198 |
+
st.download_button("Download Offer Letter", offer_letter, file_name=f"{candidate_name}_offer_letter.docx")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|