Spaces:
Running
Running
File size: 3,674 Bytes
3dff645 13c950e 3dff645 13c950e |
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 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
---
title: DishDecode
emoji: ⚡
colorFrom: pink
colorTo: pink
sdk: docker
pinned: false
license: mit
short_description: It transforms unstructured recipe videos into structured
---
---
# 📝 **Flask Audio and YouTube Video Processing API**
A Flask-based API that processes audio files and YouTube video transcripts to generate structured recipe information. It utilizes Whisper, Deepgram, and Gemini APIs for transcription and data extraction.
## 🚀 **Overview**
This API offers:
1. **Audio Processing**: Download and transcribe audio files.
2. **YouTube Transcription**: Extract transcripts from YouTube videos.
3. **Recipe Data Generation**: Generate detailed recipe data using Gemini API.
---
## 🧩 **Features**
- **Audio URL Processing**: Download and transcribe audio via Deepgram.
- **YouTube Video Processing**: Extract video transcripts and process them.
- **Structured Output**: Recipe name, ingredients, steps, techniques, and more.
- **Logging and Error Handling**: Debugging and comprehensive error responses.
---
## ⚙️ **Installation**
### 1. Clone the Repository
```bash
git clone https://github.com/your-repo-name.git
cd your-repo-name
```
### 2. Create a Virtual Environment
```bash
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
```
### 3. Install Dependencies
```bash
pip install -r requirements.txt
```
### 4. Configure Environment Variables
Create a `.env` file with your API keys:
```plaintext
FIRST_API_KEY=your_gemini_api_key
SECOND_API_KEY=your_deepgram_api_key
```
---
## 📡 **API Endpoints**
### ✅ Health Check
**GET /**
```json
{
"status": "success",
"message": "API is running successfully!"
}
```
### 🎧 Process Audio URL
**POST /process-audio**
- **Request**:
```json
{
"audioUrl": "https://example.com/audio.wav"
}
```
- **Response**:
```json
{
"structured_data": {
"Recipe Name": "Pasta Alfredo",
"Ingredients List": ["Pasta", "Cream", "Garlic"],
...
}
}
```
### 📹 Process YouTube Video
**POST /process-youtube**
- **Request**:
```json
{
"youtube_url": "https://www.youtube.com/watch?v=example"
}
```
- **Response**:
```json
{
"structured_data": {
"Recipe Name": "Grilled Cheese Sandwich",
"Ingredients List": ["Bread", "Cheese", "Butter"],
...
}
}
```
---
## 🛠️ **How It Works**
1. **Audio Processing**:
- Downloads the audio file.
- Transcribes using Deepgram.
- Sends the transcription to Gemini for structured data.
2. **YouTube Processing**:
- Extracts the video ID.
- Retrieves the transcript.
- Sends the transcript to Gemini for structured data.
---
## 📦 **Dependencies**
- **Flask**
- **Whisper**
- **Deepgram**
- **Google Gemini API**
- **YouTube Transcript API**
- **Requests**
- **Dotenv**
Install dependencies via:
```bash
pip install -r requirements.txt
```
---
## ▶️ **Run the Application**
1. **Activate Virtual Environment**:
```bash
source venv/bin/activate # Windows: venv\Scripts\activate
```
2. **Run the Flask App**:
```bash
python app.py
```
3. **Access**:
```
http://localhost:5000
```
---
## 🐞 **Error Handling**
- **API Key Errors**: Ensure `.env` contains valid API keys.
- **Invalid Input**: Returns 400 for missing URLs.
- **Transcription Errors**: Returns detailed error messages.
---
## 📝 **License**
MIT License.
---
## 👤 **Contributors**
- **Aniket**
---
💬 **Feedback or contributions?** Open an issue or submit a pull request!
Check out the configuration reference at https://huggingface.co./docs/hub/spaces-config-reference |