KunaalNaik commited on
Commit
6886a01
·
verified ·
1 Parent(s): 21d9222

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -15
app.py CHANGED
@@ -2,7 +2,7 @@ import streamlit as st
2
  import google.generativeai as genai
3
 
4
  # Header for the Streamlit app
5
- st.header("JD Keyword Extractor")
6
 
7
  # Retrieve the API key from Streamlit secrets
8
  GOOGLE_API_KEY = st.secrets["GEMINI_API_KEY"]
@@ -10,24 +10,22 @@ GOOGLE_API_KEY = st.secrets["GEMINI_API_KEY"]
10
  # Configure the Google Generative AI API with your API key
11
  genai.configure(api_key=GOOGLE_API_KEY)
12
 
13
- # Text input for Job Description
14
- user_input = st.text_area("Enter the Job Description:")
15
 
16
- # Button to submit the Job Description
17
- if st.button("Extract Keywords"):
18
  if user_input:
 
 
19
  try:
20
- # Send the Job Description to the API, asking it to extract keywords
21
- prompt = f"Extract the top keywords from this job description: {user_input}"
22
- response = genai.generate_content(model="models/gemini-1.5-bison", prompt=prompt)
23
 
24
- # Extract keywords from the response
25
- keywords = response['candidates'][0]['output']
26
-
27
- # Display the extracted keywords
28
- st.write("Top Keywords:")
29
- st.write(keywords)
30
  except Exception as e:
31
  st.error(f"Error: {e}")
32
  else:
33
- st.error("Please enter a Job Description.")
 
2
  import google.generativeai as genai
3
 
4
  # Header for the Streamlit app
5
+ st.header("Google Gemini - Generate Content")
6
 
7
  # Retrieve the API key from Streamlit secrets
8
  GOOGLE_API_KEY = st.secrets["GEMINI_API_KEY"]
 
10
  # Configure the Google Generative AI API with your API key
11
  genai.configure(api_key=GOOGLE_API_KEY)
12
 
13
+ # Text input for user prompt
14
+ user_input = st.text_area("Enter your prompt to generate content:")
15
 
16
+ # Button to submit the prompt
17
+ if st.button("Generate"):
18
  if user_input:
19
+ # Initialize the model
20
+ model = genai.GenerativeModel('gemini-pro') # Assuming this is the correct model
21
  try:
22
+ # Generate content based on the user's input
23
+ response = model.generate_content(user_input)
 
24
 
25
+ # Display the generated content
26
+ st.write("Generated Content:")
27
+ st.write(response.text)
 
 
 
28
  except Exception as e:
29
  st.error(f"Error: {e}")
30
  else:
31
+ st.error("Please enter a prompt.")