Amelia-James commited on
Commit
cec362b
·
verified ·
1 Parent(s): 6bbe9c4

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +39 -0
app.py ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import streamlit as st
3
+ from groq import Groq
4
+
5
+ # Set up Groq client with API key
6
+ client = Groq(
7
+ api_key=os.environ.get("GROQ_API_KEY"),
8
+ )
9
+
10
+ # Streamlit UI
11
+ st.title("AI-powered CV Generator")
12
+
13
+ # Input fields for CV details
14
+ name = st.text_input("Name")
15
+ email = st.text_input("Email")
16
+ phone = st.text_input("Phone Number")
17
+ experience = st.text_area("Experience")
18
+ skills = st.text_area("Skills")
19
+
20
+ # Button to generate CV
21
+ if st.button("Generate CV"):
22
+ # Constructing the content for the Groq model
23
+ prompt = f"Create a CV for {name}. Email: {email}, Phone: {phone}. Experience: {experience}. Skills: {skills}."
24
+
25
+ # Calling the Groq API
26
+ chat_completion = client.chat.completions.create(
27
+ messages=[
28
+ {
29
+ "role": "user",
30
+ "content": prompt,
31
+ }
32
+ ],
33
+ model="mixtral-8x7b-32768",
34
+ )
35
+
36
+ # Displaying the generated CV
37
+ cv_content = chat_completion.choices[0].message.content
38
+ st.write(cv_content)
39
+