baouws commited on
Commit
ddc04c6
·
verified ·
1 Parent(s): 91a5c20

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -4
app.py CHANGED
@@ -1,12 +1,12 @@
1
  import gradio as gr
2
- import os
3
 
4
  # Read the HTML content
5
  def load_html():
6
  with open("index.html", "r", encoding="utf-8") as f:
7
  return f.read()
8
 
9
- # Create the Gradio interface
10
  def create_interface():
11
  html_content = load_html()
12
 
@@ -14,7 +14,7 @@ def create_interface():
14
  title="Matrix Music Hacker",
15
  theme=gr.themes.Base(
16
  primary_hue="green",
17
- secondary_hue="cyan",
18
  neutral_hue="slate"
19
  ).set(
20
  body_background_fill="#000000",
@@ -23,7 +23,43 @@ def create_interface():
23
  )
24
  ) as interface:
25
 
26
- gr.HTML(html_content)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
  return interface
29
 
 
1
  import gradio as gr
2
+ from gradio_iframe import iframe
3
 
4
  # Read the HTML content
5
  def load_html():
6
  with open("index.html", "r", encoding="utf-8") as f:
7
  return f.read()
8
 
9
+ # Create the Gradio interface with iframe component
10
  def create_interface():
11
  html_content = load_html()
12
 
 
14
  title="Matrix Music Hacker",
15
  theme=gr.themes.Base(
16
  primary_hue="green",
17
+ secondary_hue="cyan",
18
  neutral_hue="slate"
19
  ).set(
20
  body_background_fill="#000000",
 
23
  )
24
  ) as interface:
25
 
26
+ gr.Markdown("# 🎵 Matrix Music Hacker v2.1")
27
+ gr.Markdown("*Full JavaScript-enabled version running in iframe*")
28
+
29
+ # Use iframe component to render the full HTML with working JavaScript
30
+ iframe(
31
+ html_content,
32
+ height=800,
33
+ width="100%",
34
+ label="Matrix Music Hacker Interface"
35
+ )
36
+
37
+ gr.Markdown("""
38
+ ### 📝 Instructions:
39
+ 1. **Grant Permissions**: Allow microphone access when prompted
40
+ 2. **Click "INITIATE VOICE HACK"** to start voice recognition
41
+ 3. **Speak Commands**: Try "play deep house drums" or "make cyberpunk synth"
42
+ 4. **Watch the Matrix**: Enjoy the real-time visualizations!
43
+
44
+ ### 🎯 Available Voice Commands:
45
+ - "play deep house drums"
46
+ - "create underground bass"
47
+ - "make cyberpunk synth wave"
48
+ - "play matrix ambient sounds"
49
+ - "start rave breakbeat"
50
+ - "generate random beat"
51
+
52
+ ### ⚡ Keyboard Shortcuts:
53
+ - `Ctrl + Enter`: Execute code
54
+ - `Escape`: Stop playback
55
+ - `Ctrl + R`: Start voice recognition
56
+
57
+ ### 🔧 Technical Notes:
58
+ - Requires modern browser with Web Speech API support
59
+ - Audio synthesis powered by Strudel.cc
60
+ - Matrix visualizations use Canvas 2D API
61
+ - All JavaScript functionality is preserved in iframe
62
+ """)
63
 
64
  return interface
65