Update README.md
Browse files
README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
emoji: π»
|
4 |
colorFrom: yellow
|
5 |
colorTo: green
|
@@ -11,6 +11,78 @@ license: mit
|
|
11 |
hf_oauth: true
|
12 |
hf_oauth_scopes:
|
13 |
- inference-api
|
|
|
14 |
---
|
15 |
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
title: Code Generation with CodeT5
|
3 |
emoji: π»
|
4 |
colorFrom: yellow
|
5 |
colorTo: green
|
|
|
11 |
hf_oauth: true
|
12 |
hf_oauth_scopes:
|
13 |
- inference-api
|
14 |
+
short_description: ' This repository demonstrates how to leverage CodeT5-base'
|
15 |
---
|
16 |
|
17 |
+
# π Code Generation with CodeT5
|
18 |
+
|
19 |
+
Welcome to the **Code Generation with CodeT5** project! This repository demonstrates how to leverage the `Salesforce/codet5-base` model for generating Python code snippets based on textual prompts. The project utilizes Gradio for creating interactive web interfaces and is deployed on Hugging Face Spaces.
|
20 |
+
|
21 |
+
## π Repository Contents
|
22 |
+
|
23 |
+
- **Model Configuration:**
|
24 |
+
Stored in `config.json`, this file defines the architecture and settings of the CodeT5 model.
|
25 |
+
|
26 |
+
- **Tokenizer Special Tokens:**
|
27 |
+
Located in `special_tokens_map.json`, it maps special tokens used during tokenization.
|
28 |
+
|
29 |
+
- **Training Hyperparameters:**
|
30 |
+
Found in `training_args.json`, this file contains parameters like learning rate, batch size, and number of epochs used during training.
|
31 |
+
|
32 |
+
- **Inference Code:**
|
33 |
+
The `app.py` script loads the model and provides an interface for code generation.
|
34 |
+
|
35 |
+
- **Dependencies:**
|
36 |
+
Listed in `requirements.txt`, these are the necessary packages for running the model.
|
37 |
+
|
38 |
+
- **Documentation:**
|
39 |
+
This `README.md` provides an overview and guide for setting up and using the repository.
|
40 |
+
|
41 |
+
## π§ Setup & Usage
|
42 |
+
|
43 |
+
### 1. Clone the Repository
|
44 |
+
|
45 |
+
Clone the repository to your local machine:
|
46 |
+
|
47 |
+
```bash
|
48 |
+
git clone https://github.com/your-username/codegen-model-repo.git
|
49 |
+
cd codegen-model-repo
|
50 |
+
```
|
51 |
+
|
52 |
+
### 2. Install Dependencies
|
53 |
+
|
54 |
+
Install the required packages using pip:
|
55 |
+
|
56 |
+
```bash
|
57 |
+
pip install -r requirements.txt
|
58 |
+
```
|
59 |
+
|
60 |
+
### 3. Run the Gradio App
|
61 |
+
|
62 |
+
Launch the Gradio app to start generating code:
|
63 |
+
|
64 |
+
```bash
|
65 |
+
streamlit run app.py
|
66 |
+
```
|
67 |
+
|
68 |
+
Access the app in your browser to input prompts and receive generated code snippets.
|
69 |
+
|
70 |
+
## π Deploying on Hugging Face Spaces
|
71 |
+
|
72 |
+
To deploy your Gradio app on Hugging Face Spaces:
|
73 |
+
|
74 |
+
1. **Create a New Space:**
|
75 |
+
|
76 |
+
- Visit [Hugging Face Spaces](https://huggingface.co/spaces) and create a new Space.
|
77 |
+
- Select Gradio as the SDK.
|
78 |
+
|
79 |
+
2. **Push Your Code:**
|
80 |
+
|
81 |
+
- Initialize a Git repository in your project directory.
|
82 |
+
- Commit your code and push it to the new Space's repository.
|
83 |
+
|
84 |
+
For a detailed walkthrough on deploying Gradio apps to Hugging Face Spaces, refer to this [tutorial](https://pyimagesearch.com/2024/12/30/deploy-gradio-apps-on-hugging-face-spaces/).
|
85 |
+
|
86 |
+
## π License
|
87 |
+
|
88 |
+
This project is licensed under the MIT License.
|