Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -109,4 +109,62 @@ def create_pdf(interview_text, note_text, name):
|
|
| 109 |
# Streamlit UI remains the same...
|
| 110 |
# (Keep your existing Streamlit interface code here without changes)
|
| 111 |
|
| 112 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
# Streamlit UI remains the same...
|
| 110 |
# (Keep your existing Streamlit interface code here without changes)
|
| 111 |
|
| 112 |
+
# Streamlit UI
|
| 113 |
+
st.set_page_config(page_title="Interview Generator", layout="centered")
|
| 114 |
+
st.title("π Mock Interview Generator for π΅π° Competitive Exams")
|
| 115 |
+
|
| 116 |
+
with st.form("interview_form"):
|
| 117 |
+
name = st.text_input("Full Name")
|
| 118 |
+
father_name = st.text_input("Father's Name")
|
| 119 |
+
district = st.text_input("District of Domicile")
|
| 120 |
+
tehsil = st.text_input("Tehsil")
|
| 121 |
+
bachelors = st.text_input("Bachelor's Degree (e.g., BSc Physics)")
|
| 122 |
+
masters = st.text_input("Master's Degree (e.g., MSc Public Admin or 'None')")
|
| 123 |
+
department_post = st.text_input("Department and Post (e.g., Education Dept - Lecturer English)")
|
| 124 |
+
exam_type = st.selectbox("Exam Type", ["PPSC", "FPSC", "CSS", "PMS", "Other"])
|
| 125 |
+
hobby = st.text_input("Hobby")
|
| 126 |
+
fav_personality = st.text_input("Favorite Personality")
|
| 127 |
+
submitted = st.form_submit_button("Generate Interview")
|
| 128 |
+
|
| 129 |
+
if submitted:
|
| 130 |
+
if all([name, father_name, district, tehsil, bachelors, masters, department_post, exam_type, hobby, fav_personality]):
|
| 131 |
+
# Main interview prompt
|
| 132 |
+
interview_prompt = f"""
|
| 133 |
+
Generate a detailed mock interview based on the following Pakistani candidate's profile:
|
| 134 |
+
- Name: {name}
|
| 135 |
+
- Father's Name: {father_name}
|
| 136 |
+
- District: {district}
|
| 137 |
+
- Tehsil: {tehsil}
|
| 138 |
+
- Bachelor's Degree: {bachelors}
|
| 139 |
+
- Master's Degree: {masters}
|
| 140 |
+
- Exam Type: {exam_type}
|
| 141 |
+
- Department and Post: {department_post}
|
| 142 |
+
- Hobby: {hobby}
|
| 143 |
+
- Favorite Personality: {fav_personality}
|
| 144 |
+
Include questions from:
|
| 145 |
+
- Name-based personalities
|
| 146 |
+
- District/Tehsil-specific geography, history, administration
|
| 147 |
+
- Educational background
|
| 148 |
+
- Post/Department-specific issues
|
| 149 |
+
- Pakistan's geography, national & international affairs, sports
|
| 150 |
+
- Government projects related to education
|
| 151 |
+
- Situational judgment and problem-solving
|
| 152 |
+
Format all in clear, numbered interview questions.
|
| 153 |
+
"""
|
| 154 |
+
|
| 155 |
+
# Recommendation note prompt
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
with st.spinner("Generating your personalized interview..."):
|
| 159 |
+
interview_text = get_gemini_response(interview_prompt)
|
| 160 |
+
note_text = get_gemini_response(note_prompt)
|
| 161 |
+
|
| 162 |
+
st.success("β
Interview Generated Successfully!")
|
| 163 |
+
st.text_area("π Interview Questions", interview_text, height=400)
|
| 164 |
+
st.text_area("π Special Note", note_text, height=200)
|
| 165 |
+
|
| 166 |
+
file_path = create_pdf(interview_text, note_text, name)
|
| 167 |
+
with open(file_path, "rb") as f:
|
| 168 |
+
st.download_button("π Download PDF with Recommendations", f, file_name=file_path, mime="application/pdf")
|
| 169 |
+
else:
|
| 170 |
+
st.warning("β οΈ Please complete all fields to proceed.")
|