Spaces:
Running
Running
Update pause.py
Browse files
pause.py
CHANGED
|
@@ -1,74 +1,14 @@
|
|
| 1 |
-
#!/usr/bin/env python3
|
| 2 |
-
"""
|
| 3 |
-
pause.py - Minimal Gradio app to load 1hit.no player with track #123
|
| 4 |
-
"""
|
| 5 |
-
|
| 6 |
import gradio as gr
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
src="https://1hit.no/gen/audio/mp3/d5.php?track=123"
|
| 18 |
-
width="100%"
|
| 19 |
-
height="100%"
|
| 20 |
-
style="border: none; border-radius: 10px;"
|
| 21 |
-
allow="autoplay"
|
| 22 |
-
title="1hit.no Music Player">
|
| 23 |
-
</iframe>
|
| 24 |
-
</div>
|
| 25 |
-
"""
|
| 26 |
-
|
| 27 |
-
gr.HTML(iframe_html)
|
| 28 |
-
|
| 29 |
-
# Simple controls
|
| 30 |
-
with gr.Row():
|
| 31 |
-
gr.Markdown("**Track Controls:**")
|
| 32 |
-
|
| 33 |
-
with gr.Row():
|
| 34 |
-
track_input = gr.Number(
|
| 35 |
-
label="Track Number",
|
| 36 |
-
value=123,
|
| 37 |
-
minimum=0
|
| 38 |
-
)
|
| 39 |
-
|
| 40 |
-
def update_player(track):
|
| 41 |
-
return f"""
|
| 42 |
-
<div style="width: 100%; height: 700px;">
|
| 43 |
-
<iframe
|
| 44 |
-
src="https://1hit.no/gen/audio/mp3/d5.php?track={track}"
|
| 45 |
-
width="100%"
|
| 46 |
-
height="100%"
|
| 47 |
-
style="border: none; border-radius: 10px;"
|
| 48 |
-
allow="autoplay"
|
| 49 |
-
title="1hit.no Music Player">
|
| 50 |
-
</iframe>
|
| 51 |
-
</div>
|
| 52 |
-
"""
|
| 53 |
-
|
| 54 |
-
track_input.change(
|
| 55 |
-
fn=update_player,
|
| 56 |
-
inputs=track_input,
|
| 57 |
-
outputs=gr.HTML()
|
| 58 |
-
)
|
| 59 |
-
|
| 60 |
-
gr.Markdown("---")
|
| 61 |
-
gr.Markdown("*Player URL: https://1hit.no/gen/audio/mp3/d5.php?track=123*")
|
| 62 |
|
| 63 |
-
# Launch the app
|
| 64 |
if __name__ == "__main__":
|
| 65 |
-
|
| 66 |
-
print("🎵 Loading track #123")
|
| 67 |
-
print("🌐 Local URL: http://localhost:7860")
|
| 68 |
-
print("🔄 Press Ctrl+C to stop")
|
| 69 |
-
|
| 70 |
-
app.launch(
|
| 71 |
-
server_name="0.0.0.0",
|
| 72 |
-
server_port=7860,
|
| 73 |
-
share=False
|
| 74 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
with gr.Blocks() as app:
|
| 4 |
+
gr.HTML("""
|
| 5 |
+
<iframe
|
| 6 |
+
src="https://1hit.no/gen/audio/mp3/d5.php?track=123"
|
| 7 |
+
width="100%"
|
| 8 |
+
height="700"
|
| 9 |
+
style="border:none;">
|
| 10 |
+
</iframe>
|
| 11 |
+
""")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
|
|
|
| 13 |
if __name__ == "__main__":
|
| 14 |
+
app.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|