sudiptaverse commited on
Commit
4ede375
Β·
verified Β·
1 Parent(s): 42f10b6

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +103 -4
README.md CHANGED
@@ -1,10 +1,109 @@
 
1
  ---
2
- title: DevCode
3
- emoji: πŸ†
4
  colorFrom: indigo
5
  colorTo: purple
6
- sdk: docker
 
 
7
  pinned: false
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
  ---
3
+ title: DevDeCode
4
+ emoji: πŸ’‘
5
  colorFrom: indigo
6
  colorTo: purple
7
+ sdk: gradio
8
+ sdk_version: 5.32.0
9
+ app_file: app.py
10
  pinned: false
11
  ---
12
 
13
+ # πŸ’‘ DevDeCode β€” Code Explanation API using Phi-3 & LangChain
14
+
15
+ DevDeCode is a FastAPI-powered backend that integrates Microsoft's Phi-3 Mini model using Hugging Face Transformers and LangChain. It takes Python code as input and returns a step-by-step explanation. Designed for developers and learners, this API simplifies code understanding using LLMs.
16
+
17
+ ---
18
+
19
+ ## πŸš€ Features
20
+
21
+ - 🧠 Powered by Phi-3 Mini (4K Instruct)
22
+ - πŸ”— Built with LangChain for structured LLM workflows
23
+ - 🌐 Hosted using FastAPI with auto-generated Swagger docs
24
+ - 🌍 CORS-enabled for easy frontend integration
25
+ - πŸ§ͺ Uses `StrOutputParser` for clean output formatting
26
+ - 🌩️ (Optional) Ngrok integration for public URL testing
27
+
28
+ ---
29
+
30
+ ## πŸ› οΈ Tech Stack
31
+
32
+ | Technology | Description |
33
+ |----------------------|---------------------------------------------------------------------|
34
+ | **FastAPI** | Web framework for building the RESTful API |
35
+ | **LangChain** | Manages prompt templates, model pipeline, and parsing logic |
36
+ | **Transformers** | Hugging Face library for using and fine-tuning pretrained models |
37
+ | **Phi-3 Mini** | Lightweight instruction-tuned language model from Microsoft |
38
+ | **Hugging Face Hub** | Model access, authentication, and (optional) deployment to Spaces |
39
+ | **Uvicorn** | ASGI server to run the FastAPI app |
40
+ | **PyTorch** | Deep learning backend for model execution |
41
+ | **Ngrok** *(optional)* | Tunnels localhost for public access during development |
42
+ | **CORS Middleware** | Enables smooth frontend-to-backend communication |
43
+
44
+ ---
45
+
46
+ ## πŸ“¦ Setup
47
+
48
+ 1. **Install dependencies**
49
+ ```bash
50
+ pip install -r requirements.txt
51
+ ```
52
+ *Make sure your system supports CUDA or fallback to CPU by modifying `torch_dtype` and `device_map` in your code.*
53
+
54
+ 2. **Run Locally**
55
+ ```bash
56
+ python app.py
57
+ ```
58
+
59
+ ---
60
+
61
+ ## πŸš€ Deployment
62
+
63
+ ### Deploy to Hugging Face Spaces
64
+
65
+ Ensure your repo includes:
66
+ - `README.md`
67
+ - `requirements.txt`
68
+ - `app.py`
69
+ - `huggingface.yml` *(optional but useful)*
70
+
71
+ You can use the `huggingface_hub` Python SDK or upload via the UI.
72
+
73
+ ---
74
+
75
+ ## πŸ—‚οΈ API Endpoint
76
+
77
+ - **Base URL:** `/explain`
78
+ - **Method:** `POST`
79
+ - **Input:**
80
+ ```json
81
+ {
82
+ "code": "your_python_code_here"
83
+ }
84
+ ```
85
+ - **Output:**
86
+ ```json
87
+ {
88
+ "output": "Step-by-step explanation of the code..."
89
+ }
90
+ ```
91
+
92
+ ---
93
+
94
+ ## πŸ“„ License
95
+
96
+ MIT License Β© 2025 [Your Name]
97
+
98
+ ---
99
+
100
+ ## πŸ™Œ Acknowledgements
101
+
102
+ - Microsoft for Phi-3
103
+ - Hugging Face for their incredible ecosystem
104
+ - LangChain for making LLM orchestration simple
105
+
106
+ ---
107
+
108
+
109
+ Let me know if you want me to generate the `requirements.txt` or a huggingface.yml` file for deployment!