veni18 commited on
Commit
8ef187d
·
1 Parent(s): 62670d0
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -6,7 +6,7 @@ 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
 
@@ -18,19 +18,19 @@ def speechToText(file):
18
 
19
  my_text = query(file)
20
 
21
- #sentences = my_text["text"].split(".")
22
 
23
- return my_text
24
 
25
- #translation = pipeline("translation", model="Helsinki-NLP/opus-mt-en-hu")
26
 
27
- #text_translated=[]
28
- #for text in sentences:
29
- # text_translated.append(translation(text))
30
 
31
  #combined_text = ' '.join([item['translation_text'] for sublist in text_translated for item in sublist])
32
 
33
- #return text_translated
34
 
35
  demo = gr.Interface(fn=speechToText, inputs="file", outputs="text")
36
  demo.launch()
 
6
 
7
  def speechToText(file):
8
 
9
+ api_key = os.getenv("veni18sttts")
10
  API_URL = "https://api-inference.huggingface.co/models/openai/whisper-large-v3-turbo"
11
  headers = {"Authorization": f"Bearer {api_key}"}
12
 
 
18
 
19
  my_text = query(file)
20
 
21
+ sentences = my_text["text"].split(".")
22
 
23
+
24
 
25
+ translation = pipeline("translation", model="Helsinki-NLP/opus-mt-en-hu")
26
 
27
+ text_translated=[]
28
+ for text in sentences:
29
+ text_translated.append(translation(text))
30
 
31
  #combined_text = ' '.join([item['translation_text'] for sublist in text_translated for item in sublist])
32
 
33
+ return text_translated
34
 
35
  demo = gr.Interface(fn=speechToText, inputs="file", outputs="text")
36
  demo.launch()