streamsgemini / resume.py
ombhojane's picture
Upload 4 files
fc364c3 verified
import streamlit as st
import json
import google.generativeai as genai
def app():
# Configure Google Generative AI
genai.configure(api_key="AIzaSyD-61G3GhSY97O-X2AlpXGv1MYBBMRFmwg")
# Streamlit UI
st.title("Resume")
uploaded_file = st.file_uploader("Choose a JSON file", type="json")
if uploaded_file is not None:
# Load the JSON file
data = json.load(uploaded_file)
# Set up the model configuration
generation_config = {
"temperature": 0.9,
"top_p": 1,
"top_k": 1,
"max_output_tokens": 2048,
}
safety_settings = [
{
"category": "HARM_CATEGORY_HARASSMENT",
"threshold": "BLOCK_MEDIUM_AND_ABOVE"
},
{
"category": "HARM_CATEGORY_HATE_SPEECH",
"threshold": "BLOCK_MEDIUM_AND_ABOVE"
},
{
"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
"threshold": "BLOCK_MEDIUM_AND_ABOVE"
},
{
"category": "HARM_CATEGORY_DANGEROUS_CONTENT",
"threshold": "BLOCK_MEDIUM_AND_ABOVE"
},
]
model = genai.GenerativeModel(model_name="gemini-1.0-pro",
generation_config=generation_config,
safety_settings=safety_settings)
# UI to trigger processing
if st.button("Generate Content"):
# Adjust the following line to match how you extract prompts from your JSON data
prompt_parts = f" Based on the following inputs, print the basic details in proper manner line by line (name, github url, etc), generate a professional resume that includes sections for a Summary, Experience, Skills, Certifications (dont give education section). Provide optimized content for each section of the resume to highlight the individual's qualifications, achievements, and career progression. Here are the details: {data}"
response = model.generate_content(prompt_parts)
# Display the response
st.write("Generated Content:")
st.write(response.text)