Spaces:
Runtime error
Runtime error
Commit
•
14c0ec2
1
Parent(s):
f3b023a
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
import torch
|
|
|
3 |
from transformers import pipeline
|
4 |
from timestamp import format_timestamp
|
5 |
|
@@ -27,7 +28,7 @@ def transcribe(file, task, return_timestamps):
|
|
27 |
timestamps = [f"{chunk['text']}" for chunk in timestamps]
|
28 |
|
29 |
text = "<br>".join(str(feature) for feature in timestamps)
|
30 |
-
text = f"<h4>Transcription</h4><div style='overflow-y: scroll; height:
|
31 |
return file, text
|
32 |
|
33 |
|
@@ -40,14 +41,27 @@ outputs = [gr.Audio(label="Processed Audio", type="filepath"),
|
|
40 |
|
41 |
title = "Whisper Demo: Transcribe Audio"
|
42 |
|
43 |
-
|
44 |
-
f" checkpoint [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files"
|
45 |
-
" of arbitrary length.")
|
46 |
|
|
|
|
|
|
|
47 |
|
48 |
examples = [["When a Demon Defiles a Witch.wav","transcribe",True]]
|
49 |
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
demo.queue(concurrency_count=3)
|
53 |
demo.launch(debug = True)
|
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
+
from icon import generate_icon
|
4 |
from transformers import pipeline
|
5 |
from timestamp import format_timestamp
|
6 |
|
|
|
28 |
timestamps = [f"{chunk['text']}" for chunk in timestamps]
|
29 |
|
30 |
text = "<br>".join(str(feature) for feature in timestamps)
|
31 |
+
text = f"<h4>Transcription</h4><div style='overflow-y: scroll; height: 250px;'>{text}</div>"
|
32 |
return file, text
|
33 |
|
34 |
|
|
|
41 |
|
42 |
title = "Whisper Demo: Transcribe Audio"
|
43 |
|
44 |
+
MODEL_NAME1 = "jpdiazpardo/whisper-tiny-metal"
|
|
|
|
|
45 |
|
46 |
+
description = ("Transcribe long-form audio inputs with the click of a button! Demo uses the"
|
47 |
+
f" checkpoint [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files"
|
48 |
+
" of arbitrary length. Check some of the 'cool' examples below")
|
49 |
|
50 |
examples = [["When a Demon Defiles a Witch.wav","transcribe",True]]
|
51 |
|
52 |
+
|
53 |
+
linkedin = generate_icon("linkedin")
|
54 |
+
github = generate_icon("github")
|
55 |
+
|
56 |
+
article = ("<div style='text-align: center; max-width:800px; margin:10px auto;'>"
|
57 |
+
f"<p>{linkedin} <a href='https://www.linkedin.com/in/juanpablodiazp/' target='_blank'>Juan Pablo Díaz Pardo</a><br>"
|
58 |
+
f"{github} <a href='https://github.com/jpdiazpardo' target='_blank'>jpdiazpardo</a></p>"
|
59 |
+
)
|
60 |
+
|
61 |
+
title = "Scream: Fine-Tuned Whisper model for automatic gutural speech recognition 🤟🤟🤟"
|
62 |
+
|
63 |
+
demo = gr.Interface(title = title, fn=transcribe, inputs = inputs, outputs = outputs, description=description, cache_examples=True,
|
64 |
+
allow_flagging="never", article = article , examples=examples)
|
65 |
|
66 |
demo.queue(concurrency_count=3)
|
67 |
demo.launch(debug = True)
|