Academy
Updated on
Nov 25, 2024

How to Create an AI-Powered Fashion Chatbot Using Rubra

Learn to build an AI-powered chatbot using Rubra with an open-source large language model, Llama.cpp.

How to Create an AI-Powered Fashion Chatbot Using Rubra
Ready to build AI-powered products or integrate seamless AI workflows into your enterprise or SaaS platform? Schedule a free consultation with our experts today.

In this blog post, we will provide you with a comprehensive understanding of how to leverage the power of Rubra AI to build efficient and effective AI-powered chatbots. 

What Is Rubra?

Rubra AI is an open-source tool designed to facilitate the local development of AI assistants using large language models (LLMs). It’s designed for users who want to engage with LLMs, develop and utilize assistants, and ensure their data stays private and secure. Rubra AI integrates with a variety of LLMs, including a local model optimized for Rubra. It provides a variety of tools to help you develop and utilize your own assistants. These tools include web search and knowledge retrieval. With the help of Rubra AI, we’ll build an AI-powered chatbot and observe its performance in the context of the fashion industry. Let’s roll up our sleeves, and get started!

When it comes to using Rubra AI, you can run it locally, but, even then, you need high computational power. E2E Networks provides a range of cost-effective Cloud GPUs. To start with E2E Networks, you must log into your E2E account. Set up your SSH key by visiting Settings.

After creating the SSH key, visit Compute to create a node instance.

Open your Visual Studio code, and download the extension Remote Explorer and Remote SSH. Open a new terminal. Login into your local system with the following code:

ssh root@<your-ip-address>

With this, you’ll be logged in to your node.  Now, you can start building your chatbot. 

Building an AI-Powered Chatbot to Query on the Contemporary Fashion Industry

To get started with Rubra AI, first, check the docker and docker-compose versions. The instance that you created has docker already installed. By checking the versions, you can confirm that you have both docker and docker-compose.

Now, clone the Rubra AI GitHub repository in your terminal.

git clone https://github.com/rubra-ai/rubra.git

Change the directory.

cd rubra

Pull the docker-compose image.

docker-compose pull

Start Rubra.

docker-compose up -d

Now, download the Llamafile from Hugging Face using the following command:

curl -L -o rubra.llamafile https://huggingface.co/rubra-ai/rubra-llamafile/resolve/main/rubra.llamafile

Then, execute the file permissions:

chmod +x rubra.llamafile

Run the model using the following command:

./rubra.llamafile --ctx-size 16000 -ngl 35

Rubra AI-powered chatbot with the Llama.cpp model will run on port 1234.

Here, we are building a chatbot for the fashion Industry; let’s see how our AI model is responding in this context.

Open a new terminal to query with the Llama.cpp chat, and pass the questions.

Question 1:

curl http://localhost:1234/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer no-key" \
-d' {
 "messages": [
   {
     "role": "user",
     "content": "How is technology changing the fashion industry?."
   }
  ]
}'

Answer:

{"choices":[{"finish_reason":"stop","index":0,"message":{"content":"Technology is transforming the fashion industry in various ways, including:
\n\n1. 3D Design and Virtual Fitting: With advancements in technology, designers can now create 3D models of their designs, allowing them to visualize the final product before production. This also enables customers to virtually try on clothes from the comfort of their homes.
\n\n2. Smart Fabrics: Innovations in textile technology have led to the development of smart fabrics that incorporate features like temperature regulation, self-cleaning properties, and even health monitoring capabilities.
\n\n3. Personalization and Customization: Technology has made it easier for customers to personalize their clothing choices through online platforms that offer customizable designs, sizes, and materials. This has led to a rise in demand for unique and individualized fashion pieces.
\n\n4. Sustainability: The use of technology in the fashion industry is helping to reduce waste and promote sustainability. For example, digital printing techniques have replaced traditional methods, reducing water consumption and chemical usage. Additionally, companies are using recycled materials and developing biodegradable fabrics to minimize their environmental impact.
\n\n5. Augmented Reality (AR) and Virtual Reality (VR): AR and VR technologies are being used in fashion shows, allowing viewers to experience the runway from different perspectives and even interact with the clothing virtually. This has opened up new opportunities for designers to showcase their collections and engage with customers in innovative ways.
\n\n6. Social Media and Influencer Marketing: The rise of social media platforms like Instagram and TikTok has given fashion brands a new way to reach consumers directly, while influencers have become powerful marketing tools for promoting products and trends.
\n\n7. Supply Chain Management: Technology is improving the efficiency of supply chains in the fashion industry by using data analytics, predictive modeling, and real-time tracking to optimize production, inventory management, and logistics. This helps reduce costs and minimize waste.
\n\n8. Artificial Intelligence (AI): AI is being used in various aspects of the fashion industry, from product development and design to customer service and marketing. For example, AI algorithms can analyze consumer data to predict trends and recommend personalized products to customers.
\n\nOverall, technology is reshaping the fashion industry by enhancing creativity, sustainability, efficiency, and customer experience while providing new opportunities for innovation and growth.
\n","role":"assistant"}}],"created":1709548325,"id":"chatcmplePiRULp0bhGl2EBZ20ubUBA6VKzQy3Rr","model":"uknown","object":"chat.completion","usage":{"completion_tokens":506,"prompt_tokens":36,"total_tokens":542}}

Question 2:

curl http://localhost:1234/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer no-key" \
-d '{
 "messages": [
   {
     "role": "user",
     "content": "What are some challenges facing the fashion industry today?"
   }
  ]
}'

Answer:

{"choices":[{"finish_reason":"stop","index":0,"message":{"content":"The fashion industry faces several challenges today, including:
\n\n1. Sustainability: The environmental impact of the fashion industry is significant due to its high consumption of resources and production of waste. There's a growing demand for more sustainable practices in textile manufacturing, design, and consumer behavior.
\n\n2. Fast Fashion: The rapid pace at which clothing is produced and consumed has led to overproduction, waste, and exploitation of workers. This trend has contributed to the depletion of natural resources and increased carbon emissions.
\n\n3. Ethical Labor Practices: Many fashion brands have been criticized for their poor working conditions, low wages, and lack of transparency in supply chains. Consumers are increasingly demanding more accountability from companies regarding labor practices.
\n\n4. Diversity and Inclusion: The fashion industry has historically struggled with representation and inclusion of diverse body types, genders, races, and ages. Brands are now under pressure to be more inclusive and reflect the diverse population they serve.
\n\n5. Digital Transformation: The rise of e-commerce and social media has changed the way consumers shop for fashion. Brands must adapt their marketing strategies and business models to stay competitive in this digital landscape.
\n\n6. Consumer Behavior: As consumers become more aware of the environmental and social impact of their purchases, they are demanding greater transparency from brands and seeking out sustainable and ethically produced products.
\n\n7. Regulatory Pressure: Governments around the world are introducing new laws and policies to regulate the fashion industry's environmental and labor practices. Brands must adapt to these changes or risk facing legal consequences.
\n\n8. Innovation: The fashion industry is under pressure to innovate in areas such as materials, manufacturing processes, and business models to address sustainability concerns and meet consumer demands for unique and personalized products.
\n","role":"assistant"}}],"created":1709548353,"id":"chatcmpl-SuDfvQiGthQu1toULylRVLHk1WYmFIdY","model":"uknown","object":"chat.completion","usage":{"completion_tokens":395,"prompt_tokens":38,"total_tokens":433}}

Question 3:

curl http://localhost:1234/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer no-key" \
-d '{
 "messages": [
   {
     "role": "user",
     "content": "How has the fashion industry evolved over the past decade?"
   }
  ]
}'

Answer:

{"choices":[{"finish_reason":"stop","index":0,"message":{"content":"The fashion industry has undergone significant changes over the past decade. Here are some key developments:
\n\n1. Digitalization: The rise of social media and e-commerce platforms has transformed the way people shop for clothes, with online retailers like ASOS, Boohoo, and Zalando becoming major players in the industry.
\n\n2. Sustainability: Consumers have become more aware of environmental issues, leading to a growing demand for sustainable fashion. Brands are now focusing on eco-friendly materials, fair trade practices, and reducing waste.
\n\n3. Fast Fashion: The rise of fast fashion retailers like H&M, Zara, and Forever 21 has led to increased competition and shorter product cycles. This has resulted in more affordable clothing but also concerns about the environmental impact and working conditions in the supply chain.
\n\n4. Diversity and Inclusion: The fashion industry is becoming more inclusive, with a greater representation of different body types, ethnicities, ages, and genders in advertising campaigns and runway shows. Brands are also collaborating with diverse designers and models to create more inclusive collections.
\n\n5. Streetwear and Athleisure: These casual styles have become increasingly popular, blurring the lines between sportswear and everyday fashion. Brands like Nike, Adidas, and Supreme have seen significant growth in this market.
\n\n6. Collaborations and Crossovers: Fashion brands are collaborating with artists, musicians, and other industries to create unique collections that appeal to a wider audience. Examples include Gucci's collaboration with Harry Styles and Balenciaga's partnership with IKEA.
\n\n7. Virtual Fashion: The use of virtual reality and augmented reality in fashion is on the rise, allowing consumers to try on clothes virtually or experience runway shows from home. This technology has the potential to revolutionize the way people shop for clothing.
\n\n8. Secondhand and Rental Market: As consumers become more conscious about sustainability, the secondhand and rental market for clothing has grown significantly. Platforms like Depop, Thredup, and Rent the Runway are making it easier for people to buy and rent pre-owned or designer clothes.
\n\n9. Influencer Marketing: Social media influencers have become powerful marketing tools for fashion brands, with many consumers relying on their recommendations when making purchasing decisions.
\n\n10. D2C (Direct-to-Consumer) Brands: Direct-to-consumer brands like Everlane, Allbirds, and Glossier are gaining popularity by cutting out the middleman and offering high-quality products at competitive prices. This business model allows them to have more control over their supply chain and brand messaging.
\n","role":"assistant"}}],"created":1709548381,"id":"chatcmpl-tiGoFODtlIGFoJPDwnszdh9qdEQWaJRY","model":"uknown","object":"chat.completion","usage":{"completion_tokens":587,"prompt_tokens":39,"total_tokens":626}}

Question 4:

curl http://localhost:1234/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer no-key" \
-d '{
 "messages": [
   {
     "role": "user",
     "content": "What are the current trends in sustainable fashion?"
   }
  ]
}'

Answer:

{"choices":[{"finish_reason":"stop","index":0,"message":{"content":"Sustainable fashion is an ever-evolving industry, and there are several current trends that are gaining traction. Here are some of them:
\n\n1. Circular fashion: This concept aims to reduce waste by keeping materials in use for as long as possible through repairing, reusing, recycling, and upcycling. Brands are adopting this approach to minimize their environmental impact.
\n\n2. Eco-friendly fabrics: Natural and sustainable materials like organic cotton, hemp, linen, bamboo, and Tencel are becoming more popular as they have a lower environmental footprint compared to conventional textiles.
\n\n3. Recycled materials: Many brands are using recycled polyester, nylon, and other synthetic fibers made from post-consumer waste like plastic bottles or fishing nets. This helps divert waste from landfills and oceans while reducing the need for new resources.
\n\n4. Slow fashion: The slow fashion movement encourages consumers to buy less but invest in high-quality, timeless pieces that last longer. This reduces the overall demand for fast fashion and promotes a more sustainable approach to clothing consumption.
\n\n5. Transparency: Consumers are increasingly demanding transparency from brands regarding their production processes, supply chains, and environmental impact. Brands are responding by sharing this information on their websites or through third-party certifications.
\n\n6. Rental and resale platforms: The rise of online rental and resale platforms allows consumers to borrow or buy secondhand clothing, reducing the need for new garments and keeping existing items in circulation. This helps reduce waste and promotes a more circular fashion system.
\n\n7. Collaborations with sustainable brands: Many mainstream fashion brands are partnering with eco-friendly and ethical labels to create limited edition collections or capsule ranges that align with their sustainability goals.
\n\n8. Digital fashion: The rise of virtual fashion shows, digital clothing, and NFTs (non-fungible tokens) is reducing the need for physical production and transportation, which in turn reduces the environmental impact of the fashion industry.
\n\nThese trends are helping to shift the fashion industry towards a more sustainable future, but there's still much work to be done to make it truly eco-friendly and ethical.
\n","role":"assistant"}}],"created":1709550033,"id":"chatcmpl0tcFnh3bKcpkVJ8n5Dk4jFJf6kPFZqHR","model":"uknown","object":"chat.completion","usage":{"completion_tokens":489,"prompt_tokens":37,"total_tokens":526}}

Question 5:

curl http://localhost:1234/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer no-key" \
-d '{
 "messages": [
   {
     "role": "user",
     "content": "Who are some emerging designers to watch in the fashion industry?"
  ]
}'

Answer:

{"choices":[{"finish_reason":"stop","index":0,"message":{"content":"The fashion industry is constantly evolving, and there are always new designers emerging with fresh perspectives and innovative ideas. Here are a few names to keep an eye on:
\n\n1. Peter Do: A former designer at Dior and Celine, Peter Do launched his eponymous label in 2018. His minimalist designs have quickly gained attention for their modern silhouettes and impeccable craftsmanship.
\n\n2. Bianca Saunders: This London-based designer is known for her genderless collections that explore the intersection of identity, race, and sexuality in fashion. Her work has been praised for its unique approach to design and storytelling.
\n\n3. Kenneth Ize: Nigerian designer Kenneth Ize combines traditional African textiles with contemporary silhouettes to create his signature style. His designs have been worn by celebrities like Beyoncé, and he was the first-ever African designer to showcase at Paris Fashion Week Men's.
\n\n4. Rui Zhou: A graduate of Central Saint Martins, Rui Zhou's designs are inspired by her Chinese heritage and the concept of \"wabi-sabi,\" which celebrates imperfection and transience. Her collections have been praised for their unique aesthetic and attention to detail.
\n\n5. Bode: Founded by American designer Emily Bode, this brand is known for its use of vintage textiles and antique fabrics in its designs. Bode's work has been celebrated for its commitment to sustainability and the preservation of traditional craftsmanship.
\n\n6. Ahluwalia Studio: Priya Ahluwalia's eco-conscious label repurposes deadstock materials and vintage clothing to create unique, sustainable pieces. Her designs have garnered attention for their innovative approach to fashion and commitment to sustainability.
\n\n7. Koché: Founded by Christelle Kocher in 2015, this Parisian brand combines high-end fashion with streetwear influences. Known for its playful designs and unexpected collaborations, Koché has become a favorite among celebrities and fashion insiders alike.
\n\nThis list is just a small sample of the many talented emerging designers in the fashion industry. Keep an eye on these names and others to stay up-to-date with the latest trends and innovations in the world of fashion.
\n","role":"assistant"}}],"created":1709550169,"id":"chatcmpl-nKjgfMDc7CDKLRz9Rt5ZqctRkXmvfvKf","model":"uknown","object":"chat.completion","usage":{"completion_tokens":518,"prompt_tokens":40,"total_tokens":558}}

Conclusion

We created a well-performing AI-powered chatbot who was able to answer questions regarding the fashion industry. With the help of E2E Networks’ Cloud GPUs, it was easy to run all the commands and the queries pretty quickly, with no need to set up the docker. Now, it is your turn!

Authors