Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -2,9 +2,10 @@ import gradio as gr
|
|
2 |
import requests
|
3 |
|
4 |
# Function to send audio to Groq API and get transcription
|
5 |
-
def transcribe(
|
6 |
-
#
|
7 |
-
|
|
|
8 |
|
9 |
# Replace these placeholders with your actual Groq API endpoint and headers
|
10 |
groq_api_endpoint = "https://api.groq.com/transcribe" # Example endpoint
|
@@ -26,7 +27,7 @@ def transcribe(audio):
|
|
26 |
# Gradio interface
|
27 |
iface = gr.Interface(
|
28 |
fn=transcribe,
|
29 |
-
inputs=gr.Audio(type="
|
30 |
outputs="text",
|
31 |
title="Voice to Text Converter",
|
32 |
description="Record your voice, and it will be transcribed into text using Groq API."
|
|
|
2 |
import requests
|
3 |
|
4 |
# Function to send audio to Groq API and get transcription
|
5 |
+
def transcribe(audio_path):
|
6 |
+
# Read audio file in binary mode
|
7 |
+
with open(audio_path, "rb") as audio_file:
|
8 |
+
audio_data = audio_file.read()
|
9 |
|
10 |
# Replace these placeholders with your actual Groq API endpoint and headers
|
11 |
groq_api_endpoint = "https://api.groq.com/transcribe" # Example endpoint
|
|
|
27 |
# Gradio interface
|
28 |
iface = gr.Interface(
|
29 |
fn=transcribe,
|
30 |
+
inputs=gr.Audio(type="filepath"),
|
31 |
outputs="text",
|
32 |
title="Voice to Text Converter",
|
33 |
description="Record your voice, and it will be transcribed into text using Groq API."
|