MySafeCode commited on
Commit
8df78d3
·
verified ·
1 Parent(s): 175aeed

Create pause.py

Browse files
Files changed (1) hide show
  1. pause.py +74 -0
pause.py ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ # Create the Gradio interface
9
+ with gr.Blocks(title="1hit.no Player", theme="soft") as app:
10
+ gr.Markdown("# 🎵 1hit.no Music Player")
11
+ gr.Markdown("### Loading track #123 from your player")
12
+
13
+ # Display the player in an iframe
14
+ iframe_html = """
15
+ <div style="width: 100%; height: 700px;">
16
+ <iframe
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
+ print("🚀 Starting 1hit.no Player Gradio App...")
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
+ )