Spaces:
Running
on
A10G
Running
on
A10G
Update app.py
Browse files
app.py
CHANGED
@@ -41,8 +41,12 @@ def transcribe(inputs, prompt):
|
|
41 |
generate_kwargs = {"language": "japanese", "task": "transcribe"}
|
42 |
prompt = "γ" if not prompt else prompt
|
43 |
generate_kwargs['prompt_ids'] = pipe.tokenizer.get_prompt_ids(prompt, return_tensors='pt').to(device)
|
44 |
-
|
45 |
-
|
|
|
|
|
|
|
|
|
46 |
|
47 |
def _return_yt_html_embed(yt_url):
|
48 |
video_id = yt_url.split("?v=")[-1]
|
@@ -86,8 +90,12 @@ def yt_transcribe(yt_url, prompt, max_filesize=75.0):
|
|
86 |
generate_kwargs = {"language": "japanese", "task": "transcribe"}
|
87 |
prompt = "γ" if not prompt else prompt
|
88 |
generate_kwargs['prompt_ids'] = pipe.tokenizer.get_prompt_ids(prompt, return_tensors='pt').to(device)
|
89 |
-
|
90 |
-
|
|
|
|
|
|
|
|
|
91 |
|
92 |
|
93 |
demo = gr.Blocks()
|
|
|
41 |
generate_kwargs = {"language": "japanese", "task": "transcribe"}
|
42 |
prompt = "γ" if not prompt else prompt
|
43 |
generate_kwargs['prompt_ids'] = pipe.tokenizer.get_prompt_ids(prompt, return_tensors='pt').to(device)
|
44 |
+
text = pipe(inputs, generate_kwargs=generate_kwargs)['text']
|
45 |
+
if text.startswith(f" {prompt}"):
|
46 |
+
text = text[1 + len(prompt):]
|
47 |
+
elif text.startswith(prompt"):
|
48 |
+
text = text[len(prompt):]
|
49 |
+
return text
|
50 |
|
51 |
def _return_yt_html_embed(yt_url):
|
52 |
video_id = yt_url.split("?v=")[-1]
|
|
|
90 |
generate_kwargs = {"language": "japanese", "task": "transcribe"}
|
91 |
prompt = "γ" if not prompt else prompt
|
92 |
generate_kwargs['prompt_ids'] = pipe.tokenizer.get_prompt_ids(prompt, return_tensors='pt').to(device)
|
93 |
+
text = pipe(inputs, generate_kwargs=generate_kwargs)['text']
|
94 |
+
if text.startswith(f" {prompt}"):
|
95 |
+
text = text[1 + len(prompt):]
|
96 |
+
elif text.startswith(prompt"):
|
97 |
+
text = text[len(prompt):]
|
98 |
+
return html_embed_str, text
|
99 |
|
100 |
|
101 |
demo = gr.Blocks()
|