Update app.py
Browse files
app.py
CHANGED
|
@@ -1,9 +1,8 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import requests
|
| 3 |
|
| 4 |
-
def
|
| 5 |
-
|
| 6 |
-
return ''.join(words)
|
| 7 |
|
| 8 |
def transcribe_audio(file):
|
| 9 |
api_key = "sk-proj-6J4EfDKmIduACsB38LXlT3BlbkFJSVTYDzfbVeAvbKHp1l1z"
|
|
@@ -26,12 +25,9 @@ def transcribe_audio(file):
|
|
| 26 |
print(response)
|
| 27 |
|
| 28 |
response_json = response.json()
|
| 29 |
-
|
| 30 |
|
| 31 |
-
|
| 32 |
-
return extract_words(response_json['words'])
|
| 33 |
-
else:
|
| 34 |
-
return "Error in transcription: " + response_json.get("error", {}).get("message", "Unknown error")
|
| 35 |
|
| 36 |
with gr.Blocks() as demo:
|
| 37 |
gr.Markdown("# 音声文字起こし")
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import requests
|
| 3 |
|
| 4 |
+
def extract_first_text(json_data):
|
| 5 |
+
return json_data.get('text', '')
|
|
|
|
| 6 |
|
| 7 |
def transcribe_audio(file):
|
| 8 |
api_key = "sk-proj-6J4EfDKmIduACsB38LXlT3BlbkFJSVTYDzfbVeAvbKHp1l1z"
|
|
|
|
| 25 |
print(response)
|
| 26 |
|
| 27 |
response_json = response.json()
|
| 28 |
+
extract_first_text(response_json)
|
| 29 |
|
| 30 |
+
return extract_first_text(response_json)
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
with gr.Blocks() as demo:
|
| 33 |
gr.Markdown("# 音声文字起こし")
|