The immigrant entrepreneur’s road to Silicon Valley is paved with visas. And every one tells a tale.

In the case of Purva Gupta, who is now the 29-year-old founder of Lily, a Palo Alto-based startup that’s building an AI-driven fashion app, the precious US government documents weave a kind of personal epic. In the short three years she has been in the United States, Gupta has had six separate visas, each marking a different phase of her startup quest. Gupta’s first visa came in 2013, when she moved to the US with her husband, who was getting an MBA at Yale. Then she went looking for work, finding a job with a venture-style fund at UNICEF. That required securing visa number two.

Scott Rosenberg is an editor at Backchannel. Sign up to get Backchannel's weekly newsletter, and follow us on Facebook, Twitter, and Instagram.

What she really wanted to do was start her own company. In India, at an internship with the global ad agency Saatchi & Saatchi, she’d learned about the emotional connections brands forge with customers. Then a stint with a mobile payments company left her with startup fever.

But now, in a strange country, she found herself immersed in a foreign shopping culture that disoriented her. “There were all these brands that I couldn’t afford in India,” she says. “Suddenly I’m surrounded by them, 24/7.”

In high school, she’d learned how finding just the right item of clothing could help her overcome self doubt—which, in her case, was brought on by a youthful stammer. But New York made her question herself all over again. “I am an immigrant, so I don’t know how this society works,” she recalls thinking. “What if I am being more insecure about this, and American women have figured it out?”

Others might have sought help from a friend or therapist. Gupta embarked on an intensive research project. She asked hundreds of women in New York and New Haven to tell her what they were thinking and feeling the last time they bought an item of clothing, online or offline, and why they bought it. What she discovered: It’s all about feelings. “Women are looking for clothes to accentuate the part of their body they feel most comfortable with and hide the part of their body that they don’t feel comfortable with. A customer makes a decision because that specific cut hides her belly, or that fabric makes her feel a certain way.” Yet stores do nothing to guide women toward their preferences. “There’s something here that’s fundamentally broken,” she remembers thinking. “And I’m going to fix it.”

The fix is Lily, a company that personalizes clothing shopping for women not by size or style or brand, but by emotions. To start the firm, Gupta quit her UNICEF job—switching visas again along the way. Visas number three and four were tied to changes in her husband’s visa situation, as he moved from OPT (Optional Practical Training, a sort of post-grad program) to O-1 (“individuals with extraordinary ability or achievement”) status. Gupta moved to Silicon Valley and enrolled in the Founder Institute, a startup bootcamp/accelerator. That’s where she met her co-founder, Sowmiya Chocka Narayanan—another immigrant entrepreneur in the US. Narayan had come to America in 2008 to study engineering at University of Texas at Austin; she then worked at Yahoo, the gaming startup Pocketgems, and Box before deciding to begin her own startup quest—necessitating a visa shuffle of her own, since she’d been on visas tied to her jobs.

Narayanan persuaded Gupta that the only way to build the kind of feelings-driven personalized shopping service she dreamed of was to use machine learning. “Women in this country have negative feelings about their bodies every single day,” Gupta says. “Clothes should make you feel good. Somebody’s going to change this in the world. And now we have technology that can help us.”

The two women connected with Unshackled Ventures, an early-stage fund that focuses on immigrant founders, and Lily was born in 2015. The company, which now has 15 employees, unveiled its app at South by Southwest this year, where it won an Accelerator Award. It also recently closed a seed investment round.