|
|
import os |
|
|
import gradio as gr |
|
|
from groq import Groq |
|
|
from dotenv import load_dotenv |
|
|
load_dotenv() |
|
|
|
|
|
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.", |
|
|
theme=gr.themes.Soft() |
|
|
) |
|
|
|
|
|
if __name__ == "__main__": |
|
|
iface.launch() |