Abhaykoul commited on
Commit
a4f3665
β€’
1 Parent(s): badfa0b

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +73 -0
app.py ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import requests
3
+ import time
4
+ # Function to interact with the AI
5
+ def chat_with_ai(message):
6
+ api_url = "https://free-ai-api.devastation-war.repl.co/chat"
7
+ payload = {"message": message}
8
+
9
+ try:
10
+ response = requests.post(api_url, json=payload)
11
+ if response.status_code == 200:
12
+ return response.json().get('response') # Access 'response' key
13
+ else:
14
+ return {"error": "Failed to get a response from the AI API."}
15
+ except requests.RequestException as e:
16
+ return {"error": f"Error: {e}"}
17
+
18
+ # Streamlit app
19
+ def main():
20
+ st.title("AI Resume Reviewer πŸ“")
21
+ st.sidebar.image("logo.png", use_column_width=True) # Display a logo in the sidebar
22
+ st.sidebar.markdown("## Resume Review")
23
+ st.sidebar.markdown("Please paste your resume content below.")
24
+
25
+ # User inputs for resume content
26
+ user_input = st.sidebar.text_area('Paste your resume content here (max 2048 characters):', "", max_chars=2048)
27
+
28
+ # Generate review when prompted
29
+ if st.sidebar.button('Review Resume'):
30
+ if user_input.lower() in ['quit', 'exit', 'bye']:
31
+ st.success("Goodbye! Have a great day!")
32
+ else:
33
+ with st.spinner("Requesting HelpingAI..."):
34
+ time.sleep(2) # Wait for 2 seconds
35
+ with st.spinner("Generating resume review. Please wait..."):
36
+ # Detailed and descriptive prompt
37
+ prompt = f"Please provide a comprehensive review of the following resume and suggest improvements. The goal is to enhance its effectiveness in conveying the candidate's skills and experiences. Here's the resume content: {user_input}"
38
+ response = chat_with_ai(prompt)
39
+
40
+ # Display generated review
41
+ st.subheader("Your Resume Review")
42
+ st.markdown(response)
43
+
44
+ # Save the review in the session state
45
+ if 'history' not in st.session_state:
46
+ st.session_state['history'] = []
47
+ st.session_state['history'].append({"resume": user_input, "review": response})
48
+
49
+ # Display history of reviewed resumes
50
+ if 'history' in st.session_state and st.session_state['history']:
51
+ st.markdown("---")
52
+ st.subheader("History of Reviewed Resumes")
53
+ for i, item in enumerate(st.session_state['history'], start=1):
54
+ st.markdown(f"**Resume {i}:**")
55
+ st.markdown(f"Resume Content:\n{item['resume']}")
56
+ st.markdown(f"Review:\n{item['review']}")
57
+
58
+ # About section
59
+ st.sidebar.markdown("## About")
60
+ st.sidebar.markdown("This application uses AI to review resumes based on the content you provide. It's designed to help you improve your resume. The application is made by Abhay Koul, also known as OEvortex, and it uses the API of HelpingAI, a company by OEvortex. You can learn more about OEvortex on YouTube.")
61
+
62
+ # Footer
63
+ st.sidebar.markdown("---")
64
+ st.sidebar.markdown("Β© 2023 AI Resume Reviewer by OEvortex, HelpingAI")
65
+
66
+ # Main area
67
+ st.markdown("---")
68
+ st.markdown("## Welcome to the AI Resume Reviewer! πŸ“")
69
+ st.markdown("To get started, please paste your resume content in the sidebar and click 'Review Resume'.")
70
+ st.markdown("The AI will review your resume and display the review here. You can then use these suggestions to improve your resume. Happy editing! πŸš€")
71
+
72
+ if __name__ == "__main__":
73
+ main()