Email_generator / app.py
abhishekjoel's picture
Update app.py
978bf00 verified
import gradio as gr
from transformers import AutoModelForCausalLM, AutoTokenizer
# Load the Llama 3.1 model and tokenizer
model_name = "decapoda-research/llama-30b-hf"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
# Function to generate an email
def generate_email(business_or_individual, company_details, personal_details, tokens, tone):
# ... (rest of the generate_email function remains the same)
# Create the Gradio interface with a dark theme
iface = gr.Interface(
fn=generate_email,
inputs=[
gr.Radio(["Business", "Individual"], label="Business or Individual", theme=gr.themes.Monochrome()),
gr.Group(
[
gr.Textbox(label="Company Name", theme=gr.themes.Monochrome()),
gr.Textbox(label="Industry", theme=gr.themes.Monochrome()),
gr.Textbox(label="Recipient Role", theme=gr.themes.Monochrome()),
], label="Company Details", visible=False, theme=gr.themes.Monochrome()
),
gr.Group(
[
gr.Textbox(label="Industry", theme=gr.themes.Monochrome())
], label="Personal Details", visible=False, theme=gr.themes.Monochrome()
),
gr.Slider(minimum=200, maximum=1000, step=100, label="Tokens", theme=gr.themes.Monochrome()),
gr.Radio(["Professional", "Casual", "Cold"], label="Tone", theme=gr.themes.Monochrome())
],
outputs="text",
title="Email Generator",
theme=gr.themes.Monochrome() # Set the overall theme to dark
)
# Launch the Gradio interface
iface.launch()