Upload folder using huggingface_hub
Browse files
README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
sdk_version: 5.40.0
|
8 |
-
app_file:
|
9 |
pinned: false
|
|
|
10 |
---
|
11 |
-
|
12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
+
|
2 |
---
|
3 |
+
title: dialogue_mock_diarization_main
|
4 |
+
emoji: 🔥
|
5 |
+
colorFrom: indigo
|
6 |
+
colorTo: indigo
|
7 |
sdk: gradio
|
8 |
sdk_version: 5.40.0
|
9 |
+
app_file: run.py
|
10 |
pinned: false
|
11 |
+
hf_oauth: true
|
12 |
---
|
|
|
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
gradio-client @ git+https://github.com/gradio-app/gradio@9828952dd0569d86ae15ec4fbf27331c1539daab#subdirectory=client/python
|
2 |
+
https://gradio-pypi-previews.s3.amazonaws.com/9828952dd0569d86ae15ec4fbf27331c1539daab/gradio-5.40.0-py3-none-any.whl
|
run.ipynb
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: dialogue_mock_diarization"]}, {"cell_type": "code", "execution_count": null, "id": "272996653310673477252411125948039410165", "metadata": {}, "outputs": [], "source": ["!pip install -q gradio "]}, {"cell_type": "code", "execution_count": null, "id": "288918539441861185822528903084949547379", "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "\n", "speakers = [\n", " \"Speaker 1\",\n", " \"Speaker 2\",\n", "]\n", "\n", "def format_speaker(speaker, text):\n", " return f\"{speaker}: {text}\"\n", "\n", "def mock_diarization(audio):\n", " return [\n", " {\n", " \"speaker\": \"Speaker 1\",\n", " \"text\": \"Hello, how are you?\",\n", " },\n", " {\n", " \"speaker\": \"Speaker 2\",\n", " \"text\": \"I'm fine, thank you!\",\n", " },\n", " {\n", " \"speaker\": \"Speaker 1\",\n", " \"text\": \"What's your name?\",\n", " },\n", " {\n", " \"speaker\": \"Speaker 2\",\n", " \"text\": \"My name is John Doe.\",\n", " },\n", " {\n", " \"speaker\": \"Speaker 1\",\n", " \"text\": \"Nice to meet you!\",\n", " },\n", " {\n", " \"speaker\": \"Speaker 2\",\n", " \"text\": \"Nice to meet you!\",\n", " },\n", " ]\n", "\n", "demo = gr.Interface(\n", " fn=mock_diarization,\n", " inputs=[gr.Audio(sources=[\"microphone\"])],\n", " outputs=[gr.Dialogue(speakers=speakers, tags=None, formatter=format_speaker)],\n", " title=\"Mock Speech Diarization\",\n", " description=\"Mock speech diarization\",\n", ")\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
|
run.py
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
speakers = [
|
4 |
+
"Speaker 1",
|
5 |
+
"Speaker 2",
|
6 |
+
]
|
7 |
+
|
8 |
+
def format_speaker(speaker, text):
|
9 |
+
return f"{speaker}: {text}"
|
10 |
+
|
11 |
+
def mock_diarization(audio):
|
12 |
+
return [
|
13 |
+
{
|
14 |
+
"speaker": "Speaker 1",
|
15 |
+
"text": "Hello, how are you?",
|
16 |
+
},
|
17 |
+
{
|
18 |
+
"speaker": "Speaker 2",
|
19 |
+
"text": "I'm fine, thank you!",
|
20 |
+
},
|
21 |
+
{
|
22 |
+
"speaker": "Speaker 1",
|
23 |
+
"text": "What's your name?",
|
24 |
+
},
|
25 |
+
{
|
26 |
+
"speaker": "Speaker 2",
|
27 |
+
"text": "My name is John Doe.",
|
28 |
+
},
|
29 |
+
{
|
30 |
+
"speaker": "Speaker 1",
|
31 |
+
"text": "Nice to meet you!",
|
32 |
+
},
|
33 |
+
{
|
34 |
+
"speaker": "Speaker 2",
|
35 |
+
"text": "Nice to meet you!",
|
36 |
+
},
|
37 |
+
]
|
38 |
+
|
39 |
+
demo = gr.Interface(
|
40 |
+
fn=mock_diarization,
|
41 |
+
inputs=[gr.Audio(sources=["microphone"])],
|
42 |
+
outputs=[gr.Dialogue(speakers=speakers, tags=None, formatter=format_speaker)],
|
43 |
+
title="Mock Speech Diarization",
|
44 |
+
description="Mock speech diarization",
|
45 |
+
)
|
46 |
+
|
47 |
+
if __name__ == "__main__":
|
48 |
+
demo.launch()
|