Spaces:
Sleeping
Sleeping
File size: 2,551 Bytes
1051c7d 16aec6d 1051c7d 970f795 1051c7d 16aec6d 6b437b1 16aec6d 6b437b1 16aec6d 970f795 1051c7d 6b437b1 1051c7d 2259d36 1051c7d 001abb9 6b437b1 001abb9 6b437b1 001abb9 970f795 16aec6d 001abb9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
import os
import gradio as gr
from groq import Groq
# Initialize Groq client
client = Groq(api_key=os.environ.get("GROQ_API_KEY"))
# Updated System prompt with Siddhant Goswami's profile
SYSTEM_PROMPT = """
You are an AI assistant that generates personalized emails. The recipient is Siddhant Goswami, the Co-Founder of 100x Engineers and a Generative AI Instructor.
He lives in Bengaluru, Karnataka, India.
He is currently building 100x Engineers.
He has built and scaled three products to seven figures:
- Scenes (acquired by Unacademy)
- Tapchief (acquired by Unacademy)
- Relevel
Your task is to create emails that would be relevant and engaging for someone with his background and current focus.
"""
def generate_email(name, project, key_benefits):
prompt = f"Generate an email to Siddhant Goswami as described in the system prompt. The email should be from {name}, about the project '{project}', and highlight the following key benefits: {key_benefits}. Ensure the tone is professional yet engaging, and consider Siddhant's background in tech entrepreneurship and AI."
try:
chat_completion = client.chat.completions.create(
messages=[
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": prompt}
],
model="mixtral-8x7b-32768",
temperature=0.5,
max_tokens=500,
)
return chat_completion.choices[0].message.content
except Exception as e:
return f"An error occurred: {str(e)}"
# Create Gradio interface
with gr.Blocks() as demo:
gr.Markdown("# AI Entrepreneur Email Composer")
gr.Markdown("Craft personalized emails to Siddhant Goswami, Co-Founder of 100x Engineers and Generative AI Instructor. Input your details, and our AI will generate a tailored message that resonates with his background in tech entrepreneurship and AI.")
with gr.Row():
with gr.Column():
name = gr.Textbox(label="Your Name", placeholder="Enter your name")
project = gr.Textbox(label="Project Name", placeholder="Enter your project or company name")
benefits = gr.Textbox(label="Key Benefits", placeholder="List key benefits or points of interest, separated by commas")
submit_btn = gr.Button("Generate Email")
with gr.Column():
output = gr.Textbox(label="Generated Email", lines=10)
submit_btn.click(generate_email, inputs=[name, project, benefits], outputs=output)
# Launch the app
demo.launch() |