--- title: Ttvemaildrafter emoji: 📉 colorFrom: purple colorTo: purple sdk: gradio sdk_version: 4.8.0 app_file: app.py pinned: false --- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference --- # TTV Email Draft Generator - ReadMe ## Overview The TTV Email Draft Generator is a tool designed to streamline email response processes for TTV. Leveraging OpenAI's GPT models, it assists in crafting coherent, contextually relevant email drafts quickly. ## Key Features - AI-generated email responses. - Customizable response tone and length. - Integration with GPT-3.5 and GPT-4 models. ## Functions Description ### `generate_ttv_email_response(email_content, bullet_points, tone, length, model_choice)` This function generates an email response based on provided content, bullet points, tone, and length, interfacing with the chosen AI model (GPT-3.5 or GPT-4) to create a draft that aligns with TTV's communication style. ### `sig_figs(x, precision)` Rounds a number to a specified number of significant figures, useful for displaying cost estimates with appropriate precision. ### `calculate_token_usage_price(response, model_choice)` Calculates the cost of using the OpenAI API, based on the number of tokens used in the request and response, adjusting for the selected model. ### `word_count(word)` Counts the number of words in a given string, used to set the 'Matching Client's Email Length' option. ### `get_email_length(email_content, length)` Determines the desired length of the email response based on user input and the original email's length, key for customizing the AI-generated response's length. ### `gradio_interface()` Defines and launches the Gradio interface, setting up input fields, output displays, and the overall application layout for intuitive use. ## Deployment Hosted on Hugging Face Spaces for easy access and usability. ## Usage Access via the Hugging Face Spaces link, input original email content, specify bullet points, select desired tone and length, and choose an AI model. Submit to receive a generated response and cost estimate. ## Future Enhancements Potential updates include direct email client integration, a customized user interface, and further AI response quality refinements. --- *For detailed instructions and support, refer to the user manual or contact the development team.*