File size: 1,407 Bytes
3998155
 
 
 
 
 
 
 
 
 
dde50ad
3998155
 
dde50ad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: AutoDoc
emoji: 👀
colorFrom: red
colorTo: pink
sdk: gradio
sdk_version: 5.20.1
app_file: app.py
pinned: false
license: mit
short_description: Automatically add docstrings and comments to Python using AI
---

# Automatic Python Documentation Generator

Automatically add high-quality docstrings and comments to Python code using **Gemini** or **OpenAI**. Follows PEP 257 conventions.

---

## Features
- Add docstrings and comments to Python code.
- Supports **Gemini** and **OpenAI** APIs.
- Execute and test code directly in the app.
- Clean and user-friendly Gradio interface.

---

## How to Use
1. Enter your Python code in the **Original Python Code** box.
2. Select your preferred API (**Gemini** or **OpenAI**).
3. Click **Add Documentation** to generate docstrings and comments.
4. Run the original or documented code to see the output.

---

## Requirements
- Python 3.8+
- Libraries: `gradio`, `google-generativeai`, `openai`, `python-dotenv`

---

## Setup
1. Clone the repository:
   ```bash
   git clone https://huggingface.co/spaces/ydvaidya23/AutoDoc

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

4. Add your API keys to .env:
  ```bash
  GEMINI_API_KEY=your-gemini-api-key
  OPENAI_API_KEY=your-openai-api-key

6. Run the app:
   ```bash
  python app.py

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference