Spaces:
Runtime error
Runtime error
jpdiazpardo
commited on
Commit
•
238a413
1
Parent(s):
6a22ca5
Update app.py
Browse files
app.py
CHANGED
@@ -46,7 +46,7 @@ title = "Scream: Fine-Tuned Whisper model for automatic gutural speech recogniti
|
|
46 |
classifier = pipeline("text-classification", model="j-hartmann/emotion-english-distilroberta-base", top_k=None)
|
47 |
|
48 |
#Functions-----------------------------------------------------------------------------------------------------------------------
|
49 |
-
def transcribe(
|
50 |
'''inputs: file, return_timestamps'''
|
51 |
outputs = pipe(file, batch_size=BATCH_SIZE, generate_kwargs={"task": 'transcribe'}, return_timestamps=True)
|
52 |
text = outputs["text"]
|
@@ -93,19 +93,16 @@ def hide_sentiment(value):
|
|
93 |
#Components------------------------------------------------------------------------------------------------------------------------------------
|
94 |
|
95 |
#Input components
|
96 |
-
yt_link = gr.Textbox(value=None,label="YouTube link", info = "Optional: Copy and paste YouTube URL") #0
|
97 |
-
download_button = gr.Button(value="Download") #1
|
98 |
-
thumbnail = gr.HTML(value="", label = "Thumbnail") #2
|
99 |
audio_input = gr.Audio(source="upload", type="filepath", label="Upload audio file for transcription") #3
|
100 |
timestamp_checkbox = gr.Checkbox(value=True, label="Return timestamps") #4
|
101 |
sentiment_checkbox = gr.Checkbox(value=True, label="Sentiment analysis") #5
|
102 |
|
103 |
-
inputs = [
|
104 |
-
|
105 |
-
|
106 |
-
audio_input, #3
|
107 |
-
timestamp_checkbox, #4
|
108 |
-
sentiment_checkbox] #5
|
109 |
|
110 |
#Ouput components
|
111 |
audio_out = gr.Audio(label="Processed Audio", type="filepath", info = "Vocals only")
|
@@ -119,7 +116,7 @@ outputs = [audio_out, gr.outputs.HTML("text"), sentiment_plot, sentiment_frequen
|
|
119 |
#Launch demo-----------------------------------------------------------------------------------------------------------------------------------------
|
120 |
|
121 |
with gr.Blocks() as demo:
|
122 |
-
download_button.click(download, inputs=[yt_link], outputs=[thumbnail])
|
123 |
sentiment_checkbox.change(hide_sentiment, inputs=[sentiment_checkbox], outputs=[sentiment_plot, sentiment_frequency])
|
124 |
|
125 |
|
|
|
46 |
classifier = pipeline("text-classification", model="j-hartmann/emotion-english-distilroberta-base", top_k=None)
|
47 |
|
48 |
#Functions-----------------------------------------------------------------------------------------------------------------------
|
49 |
+
def transcribe(file,use_timestamps=True,sentiment_analysis=True):
|
50 |
'''inputs: file, return_timestamps'''
|
51 |
outputs = pipe(file, batch_size=BATCH_SIZE, generate_kwargs={"task": 'transcribe'}, return_timestamps=True)
|
52 |
text = outputs["text"]
|
|
|
93 |
#Components------------------------------------------------------------------------------------------------------------------------------------
|
94 |
|
95 |
#Input components
|
96 |
+
#yt_link = gr.Textbox(value=None,label="YouTube link", info = "Optional: Copy and paste YouTube URL") #0
|
97 |
+
#download_button = gr.Button(value="Download") #1
|
98 |
+
#thumbnail = gr.HTML(value="", label = "Thumbnail") #2
|
99 |
audio_input = gr.Audio(source="upload", type="filepath", label="Upload audio file for transcription") #3
|
100 |
timestamp_checkbox = gr.Checkbox(value=True, label="Return timestamps") #4
|
101 |
sentiment_checkbox = gr.Checkbox(value=True, label="Sentiment analysis") #5
|
102 |
|
103 |
+
inputs = [audio_input, #0
|
104 |
+
timestamp_checkbox, #1
|
105 |
+
sentiment_checkbox] #2
|
|
|
|
|
|
|
106 |
|
107 |
#Ouput components
|
108 |
audio_out = gr.Audio(label="Processed Audio", type="filepath", info = "Vocals only")
|
|
|
116 |
#Launch demo-----------------------------------------------------------------------------------------------------------------------------------------
|
117 |
|
118 |
with gr.Blocks() as demo:
|
119 |
+
#download_button.click(download, inputs=[yt_link], outputs=[thumbnail])
|
120 |
sentiment_checkbox.change(hide_sentiment, inputs=[sentiment_checkbox], outputs=[sentiment_plot, sentiment_frequency])
|
121 |
|
122 |
|