Let's build a mini-ChatGPT that's powered by DeepSeek-R1 (100% local):

@_avichawla
Avi Chawla@_avichawla
21 views Jan 26, 2025 ~1 min read
1
Let's build a mini-ChatGPT that's powered by DeepSeek-R1 (100% local):
2
Here's a mini-ChatGPT app that runs locally on your computer. You can chat with it just like you would chat with ChatGPT.

We use:
- @DeepSeek_AI R1 as the LLM
- @Ollama to locally serve R1
- @chainlit_io for the UI

Let's build it!
3
We begin with the import statements and define the start_chat method.

It is invoked as soon as a new chat session starts.
Media image
4
Next, we define another method which will be invoked to generate a response from the LLM:

• The user inputs a prompt.
• We add it to the interaction history.
• We generate a response from the LLM.
• We store the LLM response in the interaction history.
Media image
5
Finally, we define the main method and run the app as follows:
Media image
6
Done!

This launches our 100% locally running mini-ChatGPT that is powered by DeepSeek-R1.
7
That's a wrap!

If you enjoyed this tutorial:

Find me → @_avichawla

Every day, I share tutorials and insights on DS, ML, LLMs, and RAGs.
Actions
What You Can Do
  • Export as PDF or Markdown
  • Batch Export to Notion
  • Bookmark & Highlight
  • LinkedIn & Instagram Carousel Maker
Create Free Account

Includes 7-day Premium trial