Text style transfer in a spreadsheet using Hugging Face Inference Endpoints

Rajiv Shah
2 min readNov 9, 2022

We change our conversational style from informal to formal speech. We often do this without thinking when talking to our friends compared to addressing a judge. Computers now have this capability! I use textual style transfer in this post to convert informal text to formal text. To make this easy to use, we do it in a spreadsheet.

The first step is identifying an informal to formal text style model. Next, we deploy the model using Hugging Face Inference endpoints. Inference endpoints is a production-grade solution for model deployment.

Let’s incorporate the endpoint into Google Sheets custom function to make the model easy to use.

I added the code to Google Sheets through the Apps Script extension. Grab it here as a gist. Once that is saved, you can use the new function as a formula. Now, I can use one simple command if I want to do textual style transfer!

I created a Youtube 🎥 video for a more detailed walkthrough.

Go try this out with your favorite model! For another example, check out the positive style textual model in a Tik Tok video.

Originally published at http://projects.rajivshah.com.

--

--

Rajiv Shah

data scientist & ai researcher @huggingface & professor @commuic. Asks the simple questions and likes shiny new tools. Was @datarobot @CaterpillarInc @StateFarm