Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
.gitattributes
CHANGED
|
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
sax.wav filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
world.mp4 filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 6.1.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: playback_position
|
| 4 |
+
emoji: 🔥
|
| 5 |
+
colorFrom: indigo
|
| 6 |
+
colorTo: indigo
|
| 7 |
sdk: gradio
|
| 8 |
sdk_version: 6.1.0
|
| 9 |
+
app_file: run.py
|
| 10 |
pinned: false
|
| 11 |
+
hf_oauth: true
|
| 12 |
---
|
|
|
|
|
|
run.ipynb
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: playback_position"]}, {"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": ["# Downloading files from the demo repo\n", "import os\n", "!wget -q https://github.com/gradio-app/gradio/raw/main/demo/playback_position/sax.wav\n", "!wget -q https://github.com/gradio-app/gradio/raw/main/demo/playback_position/world.mp4"]}, {"cell_type": "code", "execution_count": null, "id": "44380577570523278879349135829904343037", "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "from gradio.media import get_audio, get_video\n", "\n", "# Get the directory where this script is located\n", "with gr.Blocks() as demo:\n", " with gr.Tab(\"Audio\"):\n", " gr.Markdown(\"## Audio Playback Position\")\n", " gr.Markdown(\"Click the button to see the current playback position of the audio.\")\n", "\n", " audio = gr.Audio(\n", " value=get_audio(\"sax.wav\"),\n", " playback_position=2.0,\n", " elem_id=\"audio\",\n", " )\n", " audio_btn = gr.Button(\"Get Audio Playback Position\")\n", " audio_position = gr.Number(label=\"Current Audio Position (seconds)\")\n", "\n", " def print_audio_playback_pos(a: gr.Audio):\n", " return a.playback_position\n", "\n", " audio_btn.click(print_audio_playback_pos, inputs=audio, outputs=audio_position)\n", "\n", " set_audio_time_btn = gr.Button(\"Set Audio Playback Position to 10 seconds\")\n", " def set_audio_playback_pos():\n", " return gr.Audio(playback_position=10.0)\n", " \n", " set_audio_time_btn.click(set_audio_playback_pos, outputs=audio)\n", "\n", " with gr.Tab(\"Video\"):\n", " gr.Markdown(\"## Video Playback Position\")\n", " gr.Markdown(\"Click the button to see the current playback position of the video.\")\n", "\n", " video = gr.Video(\n", " value=get_video(\"world.mp4\"),\n", " playback_position=5.0,\n", " elem_id=\"video\",\n", " )\n", " video_btn = gr.Button(\"Get Video Playback Position\")\n", " video_position = gr.Number(label=\"Current Video Position (seconds)\")\n", "\n", " def print_video_playback_pos(v: gr.Video):\n", " return v.playback_position\n", "\n", " video_btn.click(print_video_playback_pos, inputs=video, outputs=video_position)\n", "\n", " set_video_time_btn = gr.Button(\"Set Video Playback Position to 8 seconds\")\n", " def set_video_playback_pos():\n", " return gr.Video(playback_position=8.0)\n", " \n", " set_video_time_btn.click(set_video_playback_pos, outputs=video) \n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
|
run.py
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from gradio.media import get_audio, get_video
|
| 3 |
+
|
| 4 |
+
# Get the directory where this script is located
|
| 5 |
+
with gr.Blocks() as demo:
|
| 6 |
+
with gr.Tab("Audio"):
|
| 7 |
+
gr.Markdown("## Audio Playback Position")
|
| 8 |
+
gr.Markdown("Click the button to see the current playback position of the audio.")
|
| 9 |
+
|
| 10 |
+
audio = gr.Audio(
|
| 11 |
+
value=get_audio("sax.wav"),
|
| 12 |
+
playback_position=2.0,
|
| 13 |
+
elem_id="audio",
|
| 14 |
+
)
|
| 15 |
+
audio_btn = gr.Button("Get Audio Playback Position")
|
| 16 |
+
audio_position = gr.Number(label="Current Audio Position (seconds)")
|
| 17 |
+
|
| 18 |
+
def print_audio_playback_pos(a: gr.Audio):
|
| 19 |
+
return a.playback_position
|
| 20 |
+
|
| 21 |
+
audio_btn.click(print_audio_playback_pos, inputs=audio, outputs=audio_position)
|
| 22 |
+
|
| 23 |
+
set_audio_time_btn = gr.Button("Set Audio Playback Position to 10 seconds")
|
| 24 |
+
def set_audio_playback_pos():
|
| 25 |
+
return gr.Audio(playback_position=10.0)
|
| 26 |
+
|
| 27 |
+
set_audio_time_btn.click(set_audio_playback_pos, outputs=audio)
|
| 28 |
+
|
| 29 |
+
with gr.Tab("Video"):
|
| 30 |
+
gr.Markdown("## Video Playback Position")
|
| 31 |
+
gr.Markdown("Click the button to see the current playback position of the video.")
|
| 32 |
+
|
| 33 |
+
video = gr.Video(
|
| 34 |
+
value=get_video("world.mp4"),
|
| 35 |
+
playback_position=5.0,
|
| 36 |
+
elem_id="video",
|
| 37 |
+
)
|
| 38 |
+
video_btn = gr.Button("Get Video Playback Position")
|
| 39 |
+
video_position = gr.Number(label="Current Video Position (seconds)")
|
| 40 |
+
|
| 41 |
+
def print_video_playback_pos(v: gr.Video):
|
| 42 |
+
return v.playback_position
|
| 43 |
+
|
| 44 |
+
video_btn.click(print_video_playback_pos, inputs=video, outputs=video_position)
|
| 45 |
+
|
| 46 |
+
set_video_time_btn = gr.Button("Set Video Playback Position to 8 seconds")
|
| 47 |
+
def set_video_playback_pos():
|
| 48 |
+
return gr.Video(playback_position=8.0)
|
| 49 |
+
|
| 50 |
+
set_video_time_btn.click(set_video_playback_pos, outputs=video)
|
| 51 |
+
|
| 52 |
+
if __name__ == "__main__":
|
| 53 |
+
demo.launch()
|
sax.wav
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:12ee32c66257e1c98ed0f2f7b708a1eab638ec09f4c69dda3ec1d78047a7be4d
|
| 3 |
+
size 1536044
|
world.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:71944d7430c461f0cd6e7fd10cee7eb72786352a3678fc7bc0ae3d410f72aece
|
| 3 |
+
size 1570024
|