eternalBlissard
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -31,20 +31,6 @@ def random_name_generator():
|
|
31 |
# Example usage:
|
32 |
# print(random_name_generator())
|
33 |
|
34 |
-
|
35 |
-
def outputProducer(inputVideo):
|
36 |
-
print(inputVideo)
|
37 |
-
input_file = ffmpeg.input(inputVideo)
|
38 |
-
name_random = random_name_generator()
|
39 |
-
input_file.output('audio'+name_random+'.mp3', acodec='mp3').run()
|
40 |
-
command2 = ["whisper",'./audio'+name_random+'.mp3']
|
41 |
-
try:
|
42 |
-
retVal = subprocess.check_output(command2)
|
43 |
-
except:
|
44 |
-
retVal = subprocess.check_output("ls")
|
45 |
-
subprocess.run(['rm', 'audio'+name_random+'.mp3'], check=True)
|
46 |
-
return retVal
|
47 |
-
|
48 |
def subtitle_it(subtitle_str):
|
49 |
# Regular expression to extract time and text
|
50 |
pattern = re.compile(
|
@@ -86,8 +72,8 @@ def respond(
|
|
86 |
):
|
87 |
# global val
|
88 |
# if ((val is None) or reprocess):
|
89 |
-
subtitles = outputProducer(system_message)
|
90 |
-
val = subtitle_it(
|
91 |
# reprocess-=1
|
92 |
messages = [{"role": "system", "content": "Answer by using the transcript"+val}]
|
93 |
|
@@ -119,8 +105,8 @@ chatbot = gr.Chatbot(height=600)
|
|
119 |
demo = gr.ChatInterface(
|
120 |
respond,
|
121 |
additional_inputs=[
|
122 |
-
gr.
|
123 |
-
gr.Slider(minimum=0, maximum=1, value=1, step=1, label="Reprocess"),
|
124 |
gr.Slider(minimum=1, maximum=4098, value=1024, step=1, label="Max new tokens"),
|
125 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
126 |
gr.Slider(
|
|
|
31 |
# Example usage:
|
32 |
# print(random_name_generator())
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
def subtitle_it(subtitle_str):
|
35 |
# Regular expression to extract time and text
|
36 |
pattern = re.compile(
|
|
|
72 |
):
|
73 |
# global val
|
74 |
# if ((val is None) or reprocess):
|
75 |
+
# subtitles = outputProducer(system_message)
|
76 |
+
val = subtitle_it(system_message)
|
77 |
# reprocess-=1
|
78 |
messages = [{"role": "system", "content": "Answer by using the transcript"+val}]
|
79 |
|
|
|
105 |
demo = gr.ChatInterface(
|
106 |
respond,
|
107 |
additional_inputs=[
|
108 |
+
gr.Textbox(value=None, label="System message"),
|
109 |
+
# gr.Slider(minimum=0, maximum=1, value=1, step=1, label="Reprocess"),
|
110 |
gr.Slider(minimum=1, maximum=4098, value=1024, step=1, label="Max new tokens"),
|
111 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
112 |
gr.Slider(
|