Spaces:
Sleeping
Sleeping
File size: 2,222 Bytes
bc5ce27 c539200 bc5ce27 c539200 bc5ce27 c539200 7d28a11 bc5ce27 7d28a11 bc5ce27 7d28a11 c539200 7d28a11 |
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 56 57 58 |
import os
import gradio as gr
from groq import Groq
client = Groq(
api_key=os.environ.get("GROQ_API_KEY"),
)
def generate_personalized_email(sender_name, project_name, key_benefits):
system_prompt = """You are an AI assistant tasked with writing a personalized email to Siddhant Goswami. Here's some information about him:
- Co-Founder of 100x Engineers
- Generative AI Instructor
- Based in Bengaluru, Karnataka, India
- Built and scaled three products to seven figures:
1. Scenes (acquired by Unacademy)
2. Tapchief (acquired by Unacademy)
3. Relevel
- Expertise in Generative AI
Write a professional and friendly email to Siddhant based on the provided inputs. The email should be personalized, mentioning his achievements and current role, while also focusing on the sender's project and its benefits."""
user_prompt = f"""Generate a personalized email to Siddhant Goswami with the following details:
- Sender's Name: {sender_name}
- Project Name: {project_name}
- Key Benefits: {key_benefits}
The email should introduce the sender, briefly describe the project, and highlight its key benefits. Make sure to relate these to Siddhant's experience and interests in Generative AI and entrepreneurship."""
chat_completion = client.chat.completions.create(
messages=[
{
"role": "system",
"content": system_prompt,
},
{
"role": "user",
"content": user_prompt,
}
],
model="llama3-8b-8192",
)
return chat_completion.choices[0].message.content
iface = gr.Interface(
fn=generate_personalized_email,
inputs=[
gr.Textbox(label="Your Name"),
gr.Textbox(label="Project Name"),
gr.Textbox(label="Key Benefits (comma-separated)")
],
outputs=gr.Textbox(label="Generated Email"),
title="Customizable Email Generator for Siddhant Goswami",
description="Generate a personalized email to Siddhant Goswami, Co-Founder of 100x Engineers and Generative AI Instructor, by providing your details and project information."
)
if __name__ == "__main__":
iface.launch() |