GoodML commited on
Commit
13c950e
·
verified ·
1 Parent(s): b7b462d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +201 -2
README.md CHANGED
@@ -6,7 +6,206 @@ colorTo: pink
6
  sdk: docker
7
  pinned: false
8
  license: mit
9
- short_description: RecipeRecon transforms unstructured recipe videos into struc
10
  ---
11
 
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  sdk: docker
7
  pinned: false
8
  license: mit
9
+ short_description: It transforms unstructured recipe videos into structured
10
  ---
11
 
12
+ ---
13
+
14
+ # 📝 **Flask Audio and YouTube Video Processing API**
15
+
16
+ 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.
17
+
18
+ ## 🚀 **Overview**
19
+
20
+ This API offers:
21
+
22
+ 1. **Audio Processing**: Download and transcribe audio files.
23
+ 2. **YouTube Transcription**: Extract transcripts from YouTube videos.
24
+ 3. **Recipe Data Generation**: Generate detailed recipe data using Gemini API.
25
+
26
+ ---
27
+
28
+ ## 🧩 **Features**
29
+
30
+ - **Audio URL Processing**: Download and transcribe audio via Deepgram.
31
+ - **YouTube Video Processing**: Extract video transcripts and process them.
32
+ - **Structured Output**: Recipe name, ingredients, steps, techniques, and more.
33
+ - **Logging and Error Handling**: Debugging and comprehensive error responses.
34
+
35
+ ---
36
+
37
+ ## ⚙️ **Installation**
38
+
39
+ ### 1. Clone the Repository
40
+
41
+ ```bash
42
+ git clone https://github.com/your-repo-name.git
43
+ cd your-repo-name
44
+ ```
45
+
46
+ ### 2. Create a Virtual Environment
47
+
48
+ ```bash
49
+ python -m venv venv
50
+ source venv/bin/activate # Windows: venv\Scripts\activate
51
+ ```
52
+
53
+ ### 3. Install Dependencies
54
+
55
+ ```bash
56
+ pip install -r requirements.txt
57
+ ```
58
+
59
+ ### 4. Configure Environment Variables
60
+
61
+ Create a `.env` file with your API keys:
62
+
63
+ ```plaintext
64
+ FIRST_API_KEY=your_gemini_api_key
65
+ SECOND_API_KEY=your_deepgram_api_key
66
+ ```
67
+
68
+ ---
69
+
70
+ ## 📡 **API Endpoints**
71
+
72
+ ### ✅ Health Check
73
+
74
+ **GET /**
75
+
76
+ ```json
77
+ {
78
+ "status": "success",
79
+ "message": "API is running successfully!"
80
+ }
81
+ ```
82
+
83
+ ### 🎧 Process Audio URL
84
+
85
+ **POST /process-audio**
86
+
87
+ - **Request**:
88
+
89
+ ```json
90
+ {
91
+ "audioUrl": "https://example.com/audio.wav"
92
+ }
93
+ ```
94
+
95
+ - **Response**:
96
+
97
+ ```json
98
+ {
99
+ "structured_data": {
100
+ "Recipe Name": "Pasta Alfredo",
101
+ "Ingredients List": ["Pasta", "Cream", "Garlic"],
102
+ ...
103
+ }
104
+ }
105
+ ```
106
+
107
+ ### 📹 Process YouTube Video
108
+
109
+ **POST /process-youtube**
110
+
111
+ - **Request**:
112
+
113
+ ```json
114
+ {
115
+ "youtube_url": "https://www.youtube.com/watch?v=example"
116
+ }
117
+ ```
118
+
119
+ - **Response**:
120
+
121
+ ```json
122
+ {
123
+ "structured_data": {
124
+ "Recipe Name": "Grilled Cheese Sandwich",
125
+ "Ingredients List": ["Bread", "Cheese", "Butter"],
126
+ ...
127
+ }
128
+ }
129
+ ```
130
+
131
+ ---
132
+
133
+ ## 🛠️ **How It Works**
134
+
135
+ 1. **Audio Processing**:
136
+ - Downloads the audio file.
137
+ - Transcribes using Deepgram.
138
+ - Sends the transcription to Gemini for structured data.
139
+
140
+ 2. **YouTube Processing**:
141
+ - Extracts the video ID.
142
+ - Retrieves the transcript.
143
+ - Sends the transcript to Gemini for structured data.
144
+
145
+ ---
146
+
147
+ ## 📦 **Dependencies**
148
+
149
+ - **Flask**
150
+ - **Whisper**
151
+ - **Deepgram**
152
+ - **Google Gemini API**
153
+ - **YouTube Transcript API**
154
+ - **Requests**
155
+ - **Dotenv**
156
+
157
+ Install dependencies via:
158
+
159
+ ```bash
160
+ pip install -r requirements.txt
161
+ ```
162
+
163
+ ---
164
+
165
+ ## ▶️ **Run the Application**
166
+
167
+ 1. **Activate Virtual Environment**:
168
+
169
+ ```bash
170
+ source venv/bin/activate # Windows: venv\Scripts\activate
171
+ ```
172
+
173
+ 2. **Run the Flask App**:
174
+
175
+ ```bash
176
+ python app.py
177
+ ```
178
+
179
+ 3. **Access**:
180
+
181
+ ```
182
+ http://localhost:5000
183
+ ```
184
+
185
+ ---
186
+
187
+ ## 🐞 **Error Handling**
188
+
189
+ - **API Key Errors**: Ensure `.env` contains valid API keys.
190
+ - **Invalid Input**: Returns 400 for missing URLs.
191
+ - **Transcription Errors**: Returns detailed error messages.
192
+
193
+ ---
194
+
195
+ ## 📝 **License**
196
+
197
+ MIT License.
198
+
199
+ ---
200
+
201
+ ## 👤 **Contributors**
202
+
203
+ - **Aniket**
204
+
205
+ ---
206
+
207
+ 💬 **Feedback or contributions?** Open an issue or submit a pull request!
208
+
209
+
210
+
211
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference