arif670 commited on
Commit
1c8df3f
·
verified ·
1 Parent(s): 36f2af1

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +43 -0
app.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from docx import Document
3
+ import io
4
+
5
+ # Function to create a Word document with the job description
6
+ def create_word_document(designation, job_description):
7
+ doc = Document()
8
+ doc.add_heading(f'Job Description for {designation}', level=1)
9
+ doc.add_paragraph(job_description)
10
+
11
+ # Save the document to a BytesIO object
12
+ doc_io = io.BytesIO()
13
+ doc.save(doc_io)
14
+ doc_io.seek(0)
15
+
16
+ return doc_io
17
+
18
+ # Streamlit app layout
19
+ st.title("Construction Company Job Description Generator")
20
+
21
+ # Input field for designation
22
+ designation = st.text_input("Enter the designation:")
23
+
24
+ # Text area for entering job description
25
+ job_description = st.text_area("Enter the job description for the role:", height=200)
26
+
27
+ if designation and job_description:
28
+ # Display job description
29
+ st.subheader("Generated Job Description:")
30
+ st.write(job_description)
31
+
32
+ # Create Word document
33
+ doc_io = create_word_document(designation, job_description)
34
+
35
+ # Download button for Word document
36
+ st.download_button(
37
+ label="Download Job Description as Word",
38
+ data=doc_io,
39
+ file_name=f"{designation.replace(' ', '_')}_job_description.docx",
40
+ mime="application/vnd.openxmlformats-officedocument.wordprocessingml.document"
41
+ )
42
+ else:
43
+ st.warning("Please enter both a designation and a job description.")