env
Browse files
app.py
CHANGED
|
@@ -2,11 +2,13 @@ import gradio as gr
|
|
| 2 |
from transformers import pipeline
|
| 3 |
import requests
|
| 4 |
import json
|
|
|
|
| 5 |
|
| 6 |
-
def
|
| 7 |
|
|
|
|
| 8 |
API_URL = "https://api-inference.huggingface.co/models/openai/whisper-large-v3-turbo"
|
| 9 |
-
headers = {"Authorization": "Bearer
|
| 10 |
|
| 11 |
def query(file):
|
| 12 |
with open(file, "rb") as f:
|
|
@@ -30,5 +32,5 @@ def greet(file):
|
|
| 30 |
|
| 31 |
#return text_translated
|
| 32 |
|
| 33 |
-
demo = gr.Interface(fn=
|
| 34 |
demo.launch()
|
|
|
|
| 2 |
from transformers import pipeline
|
| 3 |
import requests
|
| 4 |
import json
|
| 5 |
+
import os
|
| 6 |
|
| 7 |
+
def speechToText(file):
|
| 8 |
|
| 9 |
+
api_key = os.getenv("veni18sttts") # Itt olvassuk ki a secrets-ből a környezeti változót
|
| 10 |
API_URL = "https://api-inference.huggingface.co/models/openai/whisper-large-v3-turbo"
|
| 11 |
+
headers = {"Authorization": f"Bearer {api_key}"}
|
| 12 |
|
| 13 |
def query(file):
|
| 14 |
with open(file, "rb") as f:
|
|
|
|
| 32 |
|
| 33 |
#return text_translated
|
| 34 |
|
| 35 |
+
demo = gr.Interface(fn=speechToText, inputs="file", outputs="text")
|
| 36 |
demo.launch()
|