File size: 2,996 Bytes
2943699
 
0362dec
2943699
0362dec
2943699
 
 
 
0362dec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2943699
 
0362dec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2943699
0362dec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
---
title: WhatTheCode
emoji: πŸ’»
colorFrom: gray
colorTo: indigo
sdk: gradio
app_file: app.py
pinned: false
license: mit
short_description: WhatTheCode πŸ‘€ is a fun, dev-centric solution explainer
---
# WhatTheCode πŸ’»πŸ€― 
_β€œBecause sometimes your own code feels like decoding an encrypted puzzle.”_

---

![Status](https://img.shields.io/badge/status-active-brightgreen.svg)
![WhatTheCode Banner](https://img.shields.io/badge/Built%20With-Gradio%20-8A2BE2?style=flat-square)  
![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)
![Built with Groq + LLaMA 4](https://img.shields.io/badge/LLM-Meta--LLaMA_4-8A2BE2?style=flat-square&logo=meta)
![Made by Rudra](https://img.shields.io/badge/made%20by-Rudra%20Patel-blueviolet)

---

## 🎯 Overview

**WhatTheCode πŸ‘€** is a fun, dev-centric Leetcode solution explainer that turns your raw code or problem description into clean, structured, and markdown-ready explanations β€” perfect for:

- Future self-reviews 🧠
- Leetcode Discuss posts πŸ’¬
- Understanding alien πŸ‘½ code
- Teaching others (or learning from your past logic)

No fluff. No academic jargon. Just structured, fun, markdown-formatted explanations that feel like a dev wrote them at 2 AM with pizza in hand and Stack Overflow tabs open.

---

## πŸš€ Features

- ✍️ **Instant Markdown Explanations**  
  Paste your Leetcode code or problem, click a button β€” get a full explanation with:
  - `## Intuition πŸ’‘`  
  - `## Approach πŸͺœ`  
  - `## Complexity ⏳`  
  - `## Code πŸ‘¨πŸ½β€πŸ’»`  
  - Optional: `## Alternate πŸ”`

- πŸ€– **Prompt Engineered Output**  
  Built on top of Groq + Meta-LLaMA 4, carefully tuned with a cheeky, dev-friendly tone.

- πŸ” **Alternate Solution Generator**  
  Got time? Ask it to cook up a different approach with one click.

- πŸ“¦ **Copy-Paste Ready Markdown Tab**  
  Designed for fast Leetcode Discuss uploads.

---

## πŸ› οΈ Tech Stack

- `Gradio ` β€” Frontend & interactivity
- `Python` β€” Core logic
- `Groq API` β€” LLM backend (Meta LLaMA-4)
- `.env` & HuggingFace Secrets β€” for secure prompt/key handling

---

## βš™οΈ How to Use Locally

1. Clone the repo
    ```bash
    git clone https://huggingface.co/spaces/<your-username>/WhatTheCode
    cd WhatTheCode
    ```

2. Install dependencies
    ```bash
    pip install -r requirements.txt
    ```

3. Add a `.env` file:
    ```
    GROQ_API_KEY=your_groq_key_here
    MAGIC_PROMPT="Your prompt string..."
    ```

4. Run it locally:
    ```bash
    python app.py
    ```

---

## πŸ“‘ Deploy on Hugging Face Spaces

1. Push your repo to Hugging Face
2. Go to `Settings > Secrets` and add:
    - `GROQ_API_KEY`
    - `PROMPT_ADVANCE` (optional)
3. Hit β€œRestart Space” β€” and you're live!

---

## 🎨 App Metadata

```yaml
title: WhatTheCode
emoji: πŸ‘€
colorFrom: gray
colorTo: purple
sdk: gradio
app_file: app.py
license: mit
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
```