Update app.py
Browse files
app.py
CHANGED
|
@@ -1,14 +1,17 @@
|
|
| 1 |
-
import os
|
| 2 |
import whisper
|
| 3 |
from gtts import gTTS
|
| 4 |
from groq import Groq
|
| 5 |
import gradio as gr
|
| 6 |
|
|
|
|
|
|
|
|
|
|
| 7 |
# Initialize Whisper model
|
| 8 |
model = whisper.load_model("base")
|
| 9 |
|
| 10 |
-
# Initialize Groq API
|
| 11 |
-
client = Groq(api_key=
|
| 12 |
|
| 13 |
# Step 1: Transcribe Audio (Speech-to-Text using Whisper)
|
| 14 |
def transcribe_audio(audio_path):
|
|
@@ -65,4 +68,5 @@ interface = gr.Interface(
|
|
| 65 |
)
|
| 66 |
|
| 67 |
# Launch Gradio app
|
| 68 |
-
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
import whisper
|
| 3 |
from gtts import gTTS
|
| 4 |
from groq import Groq
|
| 5 |
import gradio as gr
|
| 6 |
|
| 7 |
+
# Set your Groq API key (added directly for simplicity, ensure you keep it secure)
|
| 8 |
+
os.environ["GROQ_API_KEY"] = "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"
|
| 9 |
+
|
| 10 |
# Initialize Whisper model
|
| 11 |
model = whisper.load_model("base")
|
| 12 |
|
| 13 |
+
# Initialize Groq API client
|
| 14 |
+
client = Groq(api_key=os.environ.get("GROQ_API_KEY"))
|
| 15 |
|
| 16 |
# Step 1: Transcribe Audio (Speech-to-Text using Whisper)
|
| 17 |
def transcribe_audio(audio_path):
|
|
|
|
| 68 |
)
|
| 69 |
|
| 70 |
# Launch Gradio app
|
| 71 |
+
if __name__ == "__main__":
|
| 72 |
+
interface.launch()
|