forked from openai/whisper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
67 lines (51 loc) · 1.46 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import gradio as gr
#model
#nom fichier de sortie
#dossier de sortie
#fichier qu'on analyse
#langue
import whisper
#def load_models(model_names):
# model = whisper.load_model(modelName)
# return model
model_names = [
"tiny",
"base",
"small",
"medium",
"large",
]
#models = {model_names: load_model(modelName) for model_names in model_names}
#frame1, frame2, times_to_interpolate,
def predict(model_names, fichier):
model = whisper.load_model(model_names)
# frame1 = resize(960, frame1)
#frame2 = resize(960, frame2)
#
# frame1.save("test1.png")
# frame2.save("test2.png")
# resize_img("test1.png", "test2.png")
#input_frames = ["test1.png", "resized_img2.png"]
# frames = list(
# util.interpolate_recursively_from_files(
# input_frames, times_to_interpolate, model))
# mediapy.write_video("out.mp4", frames, fps=30)
return model_names
title = "Whisper"
description = "Transcription de paroles vers texte"
article = "<p style='text-align: center'><a href='https://github.com/openai/whisper>"
gr.Interface(
predict,
[
gr.inputs.Dropdown(choices=model_names, default=model_names[0]),
gr.inputs.Audio(type="filepath"),
# gr.inputs.Image(type='filepath'),
# gr.inputs.Slider(minimum=2, maximum=100, step=1),
],
outputs = ["text"],
title=title,
description=description,
article=article,
).launch(enable_queue=True)
print(fichier)
print(model)