Upload 12 files
Browse files- login_module/__pycache__/account.cpython-311.pyc +0 -0
- login_module/__pycache__/chat.cpython-311.pyc +0 -0
- login_module/__pycache__/evaluate.cpython-311.pyc +0 -0
- login_module/__pycache__/home.cpython-311.pyc +0 -0
- login_module/__pycache__/interview.cpython-311.pyc +0 -0
- login_module/__pycache__/start_interview.cpython-311.pyc +0 -0
- login_module/__pycache__/test.cpython-311.pyc +0 -0
- login_module/account.py +33 -0
- login_module/chat.py +187 -0
- login_module/evaluate.py +130 -0
- login_module/test.py +70 -0
- login_module/your.py +27 -0
login_module/__pycache__/account.cpython-311.pyc
ADDED
|
Binary file (2.11 kB). View file
|
|
|
login_module/__pycache__/chat.cpython-311.pyc
ADDED
|
Binary file (5.72 kB). View file
|
|
|
login_module/__pycache__/evaluate.cpython-311.pyc
ADDED
|
Binary file (5.27 kB). View file
|
|
|
login_module/__pycache__/home.cpython-311.pyc
ADDED
|
Binary file (478 Bytes). View file
|
|
|
login_module/__pycache__/interview.cpython-311.pyc
ADDED
|
Binary file (1.49 kB). View file
|
|
|
login_module/__pycache__/start_interview.cpython-311.pyc
ADDED
|
Binary file (14.6 kB). View file
|
|
|
login_module/__pycache__/test.cpython-311.pyc
ADDED
|
Binary file (3.3 kB). View file
|
|
|
login_module/account.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from firebase_admin import firestore
|
| 3 |
+
|
| 4 |
+
def account_app():
|
| 5 |
+
# st.title('User :violet[Account]')
|
| 6 |
+
# check if login
|
| 7 |
+
if 'username' not in st.session_state:
|
| 8 |
+
st.session_state.username = ''
|
| 9 |
+
if 'useremail' not in st.session_state:
|
| 10 |
+
st.session_state.useremail = ''
|
| 11 |
+
|
| 12 |
+
# if not login then go to login page
|
| 13 |
+
if st.session_state.username == '':
|
| 14 |
+
st.title('Welcome to your :violet[Account]')
|
| 15 |
+
st.write('This is your account page.')
|
| 16 |
+
st.write('Here you can see your account details and change your password.')
|
| 17 |
+
st.subheader('Please login to continue')
|
| 18 |
+
st.subheader('You can login from the sidebar')
|
| 19 |
+
return
|
| 20 |
+
|
| 21 |
+
else:
|
| 22 |
+
st.title('Welcome ' + st.session_state["username"] + ' to your :violet[Account]')
|
| 23 |
+
st.write('You are logged in as: ' + st.session_state['username'])
|
| 24 |
+
st.write('Your email is: ' + st.session_state['useremail'])
|
| 25 |
+
st.write('You can also logout from here.')
|
| 26 |
+
if st.button('Logout'):
|
| 27 |
+
st.session_state.username = ''
|
| 28 |
+
st.session_state.useremail = ''
|
| 29 |
+
st.session_state.signedout = True
|
| 30 |
+
st.session_state.signout = True
|
| 31 |
+
st.success('You have been logged out')
|
| 32 |
+
st.write('You can login from the sidebar')
|
| 33 |
+
return
|
login_module/chat.py
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# PrepGenie/login_module/chat.py
|
| 2 |
+
import gradio as gr
|
| 3 |
+
import tempfile
|
| 4 |
+
import os
|
| 5 |
+
import PyPDF2
|
| 6 |
+
import google.generativeai as genai
|
| 7 |
+
from dotenv import load_dotenv
|
| 8 |
+
|
| 9 |
+
# Load environment variables
|
| 10 |
+
load_dotenv()
|
| 11 |
+
|
| 12 |
+
# Configure Generative AI
|
| 13 |
+
genai.configure(api_key=os.getenv("GOOGLE_API_KEY") or "YOUR_DEFAULT_API_KEY_HERE")
|
| 14 |
+
text_model = genai.GenerativeModel("gemini-pro")
|
| 15 |
+
|
| 16 |
+
# --- Helper Functions (Logic from Streamlit Chat) ---
|
| 17 |
+
|
| 18 |
+
def file_processing_chat(pdf_file_path):
|
| 19 |
+
"""Processes the uploaded PDF file."""
|
| 20 |
+
if not pdf_file_path:
|
| 21 |
+
return ""
|
| 22 |
+
try:
|
| 23 |
+
with open(pdf_file_path, "rb") as f:
|
| 24 |
+
reader = PyPDF2.PdfReader(f)
|
| 25 |
+
text = ""
|
| 26 |
+
for page in reader.pages:
|
| 27 |
+
text += page.extract_text()
|
| 28 |
+
return text
|
| 29 |
+
except Exception as e:
|
| 30 |
+
print(f"Error processing PDF: {e}")
|
| 31 |
+
return ""
|
| 32 |
+
|
| 33 |
+
def getallinfo_chat(data):
|
| 34 |
+
"""Formats resume data."""
|
| 35 |
+
if not data or not data.strip():
|
| 36 |
+
return "No resume data provided or data is empty."
|
| 37 |
+
|
| 38 |
+
text = f"""{data} is given by the user. Make sure you are getting the details like name, experience,
|
| 39 |
+
education, skills of the user like in a resume. If the details are not provided return: not a resume.
|
| 40 |
+
If details are provided then please try again and format the whole in a single paragraph covering all the information. """
|
| 41 |
+
try:
|
| 42 |
+
response = text_model.generate_content(text)
|
| 43 |
+
response.resolve()
|
| 44 |
+
return response.text
|
| 45 |
+
except Exception as e:
|
| 46 |
+
print(f"Error formatting resume data: {e}")
|
| 47 |
+
return "Error processing resume data."
|
| 48 |
+
|
| 49 |
+
def get_answer(question, input_text):
|
| 50 |
+
"""Generates answer/suggestions based on the question and resume text."""
|
| 51 |
+
# Handle empty inputs
|
| 52 |
+
if not question or not question.strip() or not input_text or not input_text.strip():
|
| 53 |
+
return "Please provide a question and ensure your resume is processed."
|
| 54 |
+
|
| 55 |
+
text = f"""You are a Great Resume Checker, you are given the details about the user and the user
|
| 56 |
+
needs some changes about their resume and you are the one to guide them.
|
| 57 |
+
There are queries which user wants to be solved about their resume. You are asked a question which is: {question} and
|
| 58 |
+
you have to generate suggestions to improve the resume based on the text: {input_text}. Answer in a way that the user
|
| 59 |
+
can understand and make the changes in their resume. and In paragraph form. maximum of 2 paragraphs. dont tell over the top.
|
| 60 |
+
it should be less and precise. dont tell the user to change the whole resume. just give them some suggestions. dont give
|
| 61 |
+
bullet points. Be point to point with user."""
|
| 62 |
+
try:
|
| 63 |
+
response = text_model.generate_content(text)
|
| 64 |
+
response.resolve()
|
| 65 |
+
return response.text
|
| 66 |
+
except Exception as e:
|
| 67 |
+
print(f"Error generating answer: {e}")
|
| 68 |
+
return "Sorry, I couldn't generate an answer at the moment."
|
| 69 |
+
|
| 70 |
+
# --- Gradio Chat Interface Functions ---
|
| 71 |
+
|
| 72 |
+
def process_resume_chat(file_obj):
|
| 73 |
+
"""Handles resume upload and initial processing for chat."""
|
| 74 |
+
if not file_obj:
|
| 75 |
+
return "Please upload a PDF resume.", "", gr.update(visible=False), gr.update(visible=False), gr.update(visible=False)
|
| 76 |
+
|
| 77 |
+
try:
|
| 78 |
+
# Save uploaded file to a temporary location
|
| 79 |
+
temp_dir = tempfile.mkdtemp()
|
| 80 |
+
file_path = os.path.join(temp_dir, file_obj.name)
|
| 81 |
+
with open(file_path, "wb") as f:
|
| 82 |
+
f.write(file_obj.read())
|
| 83 |
+
|
| 84 |
+
# Process the PDF
|
| 85 |
+
raw_text = file_processing_chat(file_path)
|
| 86 |
+
if not raw_text.strip():
|
| 87 |
+
os.remove(file_path)
|
| 88 |
+
os.rmdir(temp_dir)
|
| 89 |
+
return "Could not extract text from the PDF.", "", gr.update(visible=False), gr.update(visible=False), gr.update(visible=False)
|
| 90 |
+
|
| 91 |
+
processed_data = getallinfo_chat(raw_text)
|
| 92 |
+
|
| 93 |
+
# Clean up temporary file
|
| 94 |
+
os.remove(file_path)
|
| 95 |
+
os.rmdir(temp_dir)
|
| 96 |
+
|
| 97 |
+
return (
|
| 98 |
+
f"Resume processed successfully!",
|
| 99 |
+
processed_data, # Pass processed data for chat
|
| 100 |
+
gr.update(visible=True), # Show chat input
|
| 101 |
+
gr.update(visible=True), # Show send button
|
| 102 |
+
[] # Clear previous chat history (return empty list for Chatbot)
|
| 103 |
+
)
|
| 104 |
+
except Exception as e:
|
| 105 |
+
error_msg = f"Error processing file: {str(e)}"
|
| 106 |
+
print(error_msg)
|
| 107 |
+
return error_msg, "", gr.update(visible=False), gr.update(visible=False), gr.update(visible=False)
|
| 108 |
+
|
| 109 |
+
def chat_with_resume(query, resume_data, history):
|
| 110 |
+
"""Handles the chat interaction."""
|
| 111 |
+
# history is automatically managed by Gradio Chatbot, we just need to append to it
|
| 112 |
+
if not query or not query.strip() or not resume_data or not resume_data.strip():
|
| 113 |
+
# Return existing history if inputs are missing or empty
|
| 114 |
+
# Gradio Chatbot expects a list of tuples [(user_msg, bot_response), ...]
|
| 115 |
+
# If history is None, initialize as empty list
|
| 116 |
+
current_history = history if history is not None else []
|
| 117 |
+
# Add the error message to the chat history
|
| 118 |
+
current_history.append((query if query else "", "Please enter a question and ensure your resume is processed."))
|
| 119 |
+
return "", current_history # Clear input, update history
|
| 120 |
+
|
| 121 |
+
try:
|
| 122 |
+
answer = get_answer(query, resume_data)
|
| 123 |
+
# Update history
|
| 124 |
+
# Gradio Chatbot expects a list of tuples [(user_msg, bot_response), ...]
|
| 125 |
+
current_history = history if history is not None else []
|
| 126 |
+
current_history.append((query, answer))
|
| 127 |
+
return "", current_history # Clear input, update history
|
| 128 |
+
except Exception as e:
|
| 129 |
+
error_msg = f"Error during chat: {str(e)}"
|
| 130 |
+
print(error_msg)
|
| 131 |
+
current_history = history if history is not None else []
|
| 132 |
+
current_history.append((query, error_msg))
|
| 133 |
+
return "", current_history
|
| 134 |
+
|
| 135 |
+
# --- Gradio Chat Interface ---
|
| 136 |
+
# This can be integrated into the main app.py or run as a separate demo
|
| 137 |
+
# For integration, you would typically define these components inside a Gradio Column/Row
|
| 138 |
+
# within app.py and connect their event listeners there.
|
| 139 |
+
|
| 140 |
+
# Example of how this might look as a standalone demo (commented out for integration):
|
| 141 |
+
#
|
| 142 |
+
# with gr.Blocks(title="PrepGenie - Chat with Resume") as chat_demo:
|
| 143 |
+
# gr.Markdown("# 🦈 PrepGenie - Chat with Resume")
|
| 144 |
+
# gr.Markdown("Upload your resume and ask questions about it.")
|
| 145 |
+
#
|
| 146 |
+
# # State for processed resume data
|
| 147 |
+
# processed_resume_data_chat = gr.State("")
|
| 148 |
+
#
|
| 149 |
+
# with gr.Row():
|
| 150 |
+
# with gr.Column():
|
| 151 |
+
# file_upload_chat = gr.File(label="Upload Resume (PDF)", file_types=[".pdf"])
|
| 152 |
+
# process_chat_btn = gr.Button("Process Resume")
|
| 153 |
+
# with gr.Column():
|
| 154 |
+
# file_status_chat = gr.Textbox(label="Status", interactive=False)
|
| 155 |
+
#
|
| 156 |
+
# # Chat Section (Initially hidden)
|
| 157 |
+
# chatbot = gr.Chatbot(label="Chat History", visible=False)
|
| 158 |
+
# query_input = gr.Textbox(label="Ask about your resume", placeholder="Type your question here...", visible=False)
|
| 159 |
+
# send_btn = gr.Button("Send", visible=False)
|
| 160 |
+
#
|
| 161 |
+
# # --- Event Listeners for Chat ---
|
| 162 |
+
#
|
| 163 |
+
# # Process Resume for Chat
|
| 164 |
+
# process_chat_btn.click(
|
| 165 |
+
# fn=process_resume_chat,
|
| 166 |
+
# inputs=[file_upload_chat],
|
| 167 |
+
# outputs=[file_status_chat, processed_resume_data_chat, query_input, send_btn, chatbot]
|
| 168 |
+
# )
|
| 169 |
+
#
|
| 170 |
+
# # Chat Interaction
|
| 171 |
+
# send_btn.click(
|
| 172 |
+
# fn=chat_with_resume,
|
| 173 |
+
# inputs=[query_input, processed_resume_data_chat, chatbot], # chatbot provides history
|
| 174 |
+
# outputs=[query_input, chatbot] # Update input (clear) and chatbot (new history)
|
| 175 |
+
# )
|
| 176 |
+
# query_input.submit( # Allow submitting with Enter key
|
| 177 |
+
# fn=chat_with_resume,
|
| 178 |
+
# inputs=[query_input, processed_resume_data_chat, chatbot],
|
| 179 |
+
# outputs=[query_input, chatbot]
|
| 180 |
+
# )
|
| 181 |
+
#
|
| 182 |
+
# # Run the chat app separately or integrate into main app
|
| 183 |
+
# # if __name__ == "__main__":
|
| 184 |
+
# # chat_demo.launch()
|
| 185 |
+
|
| 186 |
+
# Print statement to confirm module load (optional)
|
| 187 |
+
print("Chat module loaded successfully.")
|
login_module/evaluate.py
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import gradio as gr
|
| 3 |
+
import matplotlib.pyplot as plt
|
| 4 |
+
import numpy as np
|
| 5 |
+
import io
|
| 6 |
+
import base64
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def create_metrics_chart(metrics_dict):
|
| 11 |
+
"""Creates a pie chart image from metrics."""
|
| 12 |
+
try:
|
| 13 |
+
labels = list(metrics_dict.keys())
|
| 14 |
+
sizes = list(metrics_dict.values())
|
| 15 |
+
|
| 16 |
+
fig, ax = plt.subplots(figsize=(6, 6)) # Adjust size as needed
|
| 17 |
+
ax.pie(sizes, labels=labels, autopct='%1.1f%%', startangle=90)
|
| 18 |
+
ax.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle.
|
| 19 |
+
|
| 20 |
+
# Save plot to a BytesIO object
|
| 21 |
+
buf = io.BytesIO()
|
| 22 |
+
plt.savefig(buf, format='png')
|
| 23 |
+
buf.seek(0)
|
| 24 |
+
plt.close(fig) # Important to close the figure
|
| 25 |
+
return buf
|
| 26 |
+
except Exception as e:
|
| 27 |
+
print(f"Error creating chart: {e}")
|
| 28 |
+
return None
|
| 29 |
+
|
| 30 |
+
def generate_evaluation_report(metrics_data_list):
|
| 31 |
+
"""
|
| 32 |
+
Generates a text evaluation report and a chart.
|
| 33 |
+
metrics_data_list: List of dictionaries, each containing metrics for a question.
|
| 34 |
+
"""
|
| 35 |
+
if not metrics_data_list:
|
| 36 |
+
return "No interview data available for evaluation.", None
|
| 37 |
+
|
| 38 |
+
# Aggregate metrics (average scores)
|
| 39 |
+
aggregated_metrics = {
|
| 40 |
+
"Communication skills": 0.0,
|
| 41 |
+
"Teamwork and collaboration": 0.0,
|
| 42 |
+
"Problem-solving and critical thinking": 0.0,
|
| 43 |
+
"Time management and organization": 0.0,
|
| 44 |
+
"Adaptability and resilience": 0.0
|
| 45 |
+
}
|
| 46 |
+
num_questions = len(metrics_data_list)
|
| 47 |
+
if num_questions == 0:
|
| 48 |
+
num_questions = 1 # Avoid division by zero
|
| 49 |
+
|
| 50 |
+
for metrics_dict in metrics_data_list:
|
| 51 |
+
for key, value in metrics_dict.items():
|
| 52 |
+
if key in aggregated_metrics:
|
| 53 |
+
aggregated_metrics[key] += value
|
| 54 |
+
|
| 55 |
+
for key in aggregated_metrics:
|
| 56 |
+
aggregated_metrics[key] /= num_questions
|
| 57 |
+
aggregated_metrics[key] = round(aggregated_metrics[key], 2) # Round to 2 decimal places
|
| 58 |
+
|
| 59 |
+
average_rating = sum(aggregated_metrics.values()) / len(aggregated_metrics)
|
| 60 |
+
average_rating = round(average_rating, 2)
|
| 61 |
+
|
| 62 |
+
# --- Generate Text Report ---
|
| 63 |
+
report_lines = [f"## Hey Candidate, here is your interview evaluation:\n"]
|
| 64 |
+
report_lines.append("### Skill Ratings:\n")
|
| 65 |
+
for metric, rating in aggregated_metrics.items():
|
| 66 |
+
report_lines.append(f"* **{metric}:** {rating}/10\n")
|
| 67 |
+
|
| 68 |
+
report_lines.append(f"\n### Overall Average Rating: {average_rating:.2f}/10\n")
|
| 69 |
+
|
| 70 |
+
improvement_content = """
|
| 71 |
+
### Areas for Improvement:
|
| 72 |
+
|
| 73 |
+
* **Communication:** Focus on clarity, conciseness, and tailoring your responses to the audience. Use examples and evidence to support your points.
|
| 74 |
+
* **Teamwork and collaboration:** Highlight your teamwork skills through specific examples and demonstrate your ability to work effectively with others.
|
| 75 |
+
* **Problem-solving and critical thinking:** Clearly explain your problem-solving approach and thought process. Show your ability to analyze information and arrive at logical solutions.
|
| 76 |
+
* **Time management and organization:** Emphasize your ability to manage time effectively and stay organized during challenging situations.
|
| 77 |
+
* **Adaptability and resilience:** Demonstrate your ability to adapt to new situations and overcome challenges. Share examples of how you have handled unexpected situations or setbacks in the past.
|
| 78 |
+
|
| 79 |
+
**Remember:** This is just a starting point. Customize the feedback based on the specific strengths and weaknesses identified in your interview.
|
| 80 |
+
"""
|
| 81 |
+
report_lines.append(improvement_content)
|
| 82 |
+
report_text = "".join(report_lines)
|
| 83 |
+
|
| 84 |
+
# --- Generate Chart ---
|
| 85 |
+
chart_buffer = create_metrics_chart(aggregated_metrics)
|
| 86 |
+
|
| 87 |
+
return report_text, chart_buffer
|
| 88 |
+
|
| 89 |
+
# --- Gradio Interface for Evaluation (Example Usage) ---
|
| 90 |
+
|
| 91 |
+
# This part would typically be called from your main interview completion logic
|
| 92 |
+
# and the outputs connected to Gradio components.
|
| 93 |
+
|
| 94 |
+
# Example dummy data for testing the evaluation function
|
| 95 |
+
# dummy_metrics_data = [
|
| 96 |
+
# {
|
| 97 |
+
# "Communication skills": 7.5,
|
| 98 |
+
# "Teamwork and collaboration": 6.0,
|
| 99 |
+
# "Problem-solving and critical thinking": 8.0,
|
| 100 |
+
# "Time management and organization": 5.5,
|
| 101 |
+
# "Adaptability and resilience": 7.0
|
| 102 |
+
# },
|
| 103 |
+
# {
|
| 104 |
+
# "Communication skills": 8.0,
|
| 105 |
+
# "Teamwork and collaboration": 7.5,
|
| 106 |
+
# "Problem-solving and critical thinking": 6.5,
|
| 107 |
+
# "Time management and organization": 8.0,
|
| 108 |
+
# "Adaptability and resilience": 6.0
|
| 109 |
+
# }
|
| 110 |
+
# ]
|
| 111 |
+
|
| 112 |
+
# def run_evaluation(metrics_data_input):
|
| 113 |
+
# report, chart = generate_evaluation_report(metrics_data_input)
|
| 114 |
+
# return report, chart
|
| 115 |
+
|
| 116 |
+
# with gr.Blocks() as eval_demo:
|
| 117 |
+
# gr.Markdown("## Interview Evaluation")
|
| 118 |
+
# metrics_input = gr.JSON(label="Metrics Data (List of Dicts)", value=dummy_metrics_data)
|
| 119 |
+
# run_btn = gr.Button("Generate Evaluation")
|
| 120 |
+
# report_output = gr.Markdown(label="Evaluation Report")
|
| 121 |
+
# chart_output = gr.Image(label="Skills Breakdown", type="pil") # or type="filepath"
|
| 122 |
+
|
| 123 |
+
# run_btn.click(
|
| 124 |
+
# fn=run_evaluation,
|
| 125 |
+
# inputs=metrics_input,
|
| 126 |
+
# outputs=[report_output, chart_output]
|
| 127 |
+
# )
|
| 128 |
+
|
| 129 |
+
# if __name__ == "__main__":
|
| 130 |
+
# eval_demo.launch()
|
login_module/test.py
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# import streamlit as st
|
| 2 |
+
# from firebase_admin import auth
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
# # cred = credentials.Certificate("pondering-5ff7c-c033cfade319.json")
|
| 6 |
+
# # firebase_admin.initialize_app(cred)
|
| 7 |
+
# def test_app():
|
| 8 |
+
# # Usernm = []
|
| 9 |
+
# st.title('Welcome to our :violet[Mock Interview]')
|
| 10 |
+
|
| 11 |
+
# if 'username' not in st.session_state:
|
| 12 |
+
# st.session_state.username = ''
|
| 13 |
+
# if 'useremail' not in st.session_state:
|
| 14 |
+
# st.session_state.useremail = ''
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
# def f():
|
| 18 |
+
# try:
|
| 19 |
+
# user = auth.get_user_by_email(email)
|
| 20 |
+
# # print(user.uid)
|
| 21 |
+
# print('Login Successful')
|
| 22 |
+
# st.session_state.username = user.uid
|
| 23 |
+
# st.session_state.useremail = user.email
|
| 24 |
+
|
| 25 |
+
# global Usernm
|
| 26 |
+
# Usernm=(user.uid)
|
| 27 |
+
|
| 28 |
+
# st.session_state.signedout = True
|
| 29 |
+
# st.session_state.signout = True
|
| 30 |
+
|
| 31 |
+
# except:
|
| 32 |
+
# st.warning('Login Failed')
|
| 33 |
+
|
| 34 |
+
# def t():
|
| 35 |
+
# st.session_state.signout = False
|
| 36 |
+
# st.session_state.signedout = False
|
| 37 |
+
# st.session_state.username = ''
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
# if "signedout" not in st.session_state:
|
| 41 |
+
# st.session_state["signedout"] = False
|
| 42 |
+
# if 'signout' not in st.session_state:
|
| 43 |
+
# st.session_state['signout'] = False
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
# if not st.session_state["signedout"]: # only show if the state is False, hence the button has never been clicked
|
| 47 |
+
# choice = st.selectbox('Login/Signup',['Login','Sign up'])
|
| 48 |
+
# email = st.text_input('Email Address')
|
| 49 |
+
# password = st.text_input('Password',type='password')
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
# if choice == 'Sign up':
|
| 54 |
+
# username = st.text_input("Enter your unique username")
|
| 55 |
+
|
| 56 |
+
# if st.button('Create my account'):
|
| 57 |
+
# user = auth.create_user(email = email, password = password,uid=username)
|
| 58 |
+
|
| 59 |
+
# st.success('Account created successfully!')
|
| 60 |
+
# st.markdown('Please Login using your email and password')
|
| 61 |
+
# st.balloons()
|
| 62 |
+
# else:
|
| 63 |
+
# # st.button('Login', on_click=f)
|
| 64 |
+
# st.button('Login', on_click=f)
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
# if st.session_state.signout:
|
| 68 |
+
# st.text('Name '+st.session_state.username)
|
| 69 |
+
# st.text('Email id: '+st.session_state.useremail)
|
| 70 |
+
# st.button('Sign out', on_click=t)
|
login_module/your.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# import streamlit as st
|
| 2 |
+
# from firebase_admin import firestore
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
# def app():
|
| 6 |
+
# db=firestore.client()
|
| 7 |
+
# try:
|
| 8 |
+
# st.title('Posted by: '+st.session_state['username'] )
|
| 9 |
+
# result = db.collection('Posts').document(st.session_state['username']).get()
|
| 10 |
+
# r=result.to_dict()
|
| 11 |
+
# content = r['Content']
|
| 12 |
+
# def delete_post(k):
|
| 13 |
+
# c=int(k)
|
| 14 |
+
# h=content[c]
|
| 15 |
+
# try:
|
| 16 |
+
# db.collection('Posts').document(st.session_state['username']).update({"Content": firestore.ArrayRemove([h])})
|
| 17 |
+
# st.warning('Post deleted')
|
| 18 |
+
# except:
|
| 19 |
+
# st.write('Something went wrong..')
|
| 20 |
+
# for c in range(len(content)-1,-1,-1):
|
| 21 |
+
# st.text_area(label='',value=content[c])
|
| 22 |
+
# st.button('Delete Post', on_click=delete_post, args=([c] ), key=c)
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
# except:
|
| 26 |
+
# if st.session_state.username=='':
|
| 27 |
+
# st.text('Please Login first')
|