Artificial-superintelligence commited on
Commit
bb0d3d8
·
verified ·
1 Parent(s): d9462b0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -4
app.py CHANGED
@@ -57,17 +57,22 @@ mobile_emulator_css = """
57
  # HTML for mobile emulator
58
  mobile_emulator_html = """
59
  <div class="mobile-emulator">
60
- <iframe src="https://www.google.com"></iframe>
61
  </div>
62
  """
63
 
64
- # JavaScript to open Chrome app
65
  chrome_app_js = """
66
  <script>
67
  function openChromeApp() {
68
  alert('Opening Chrome App...');
69
  // You can replace the alert with actual logic to open a Chrome app
70
  }
 
 
 
 
 
71
  </script>
72
  """
73
 
@@ -80,9 +85,22 @@ st.markdown(mobile_emulator_css, unsafe_allow_html=True)
80
  # Display HTML
81
  st.markdown(mobile_emulator_html, unsafe_allow_html=True)
82
 
83
- # Button to open Chrome app
84
  st.markdown(chrome_app_js, unsafe_allow_html=True)
85
- st.button("Open Chrome App", on_click=openChromeApp)
 
 
 
 
 
 
 
 
 
 
 
 
 
86
 
87
  # Run the Streamlit app
88
  if __name__ == "__main__":
 
57
  # HTML for mobile emulator
58
  mobile_emulator_html = """
59
  <div class="mobile-emulator">
60
+ <iframe id="mobile-iframe" src="https://www.google.com"></iframe>
61
  </div>
62
  """
63
 
64
+ # JavaScript to open Chrome app and search
65
  chrome_app_js = """
66
  <script>
67
  function openChromeApp() {
68
  alert('Opening Chrome App...');
69
  // You can replace the alert with actual logic to open a Chrome app
70
  }
71
+
72
+ function search(query) {
73
+ var iframe = document.getElementById('mobile-iframe');
74
+ iframe.src = 'https://www.google.com/search?q=' + encodeURIComponent(query);
75
+ }
76
  </script>
77
  """
78
 
 
85
  # Display HTML
86
  st.markdown(mobile_emulator_html, unsafe_allow_html=True)
87
 
88
+ # Display JavaScript
89
  st.markdown(chrome_app_js, unsafe_allow_html=True)
90
+
91
+ # Button to open Chrome app
92
+ if st.button("Open Chrome App"):
93
+ st.write("Opening Chrome App...")
94
+
95
+ # Search functionality
96
+ search_query = st.text_input("Search", "")
97
+ if st.button("Search"):
98
+ st.write(f"Searching for: {search_query}")
99
+ st.markdown(f"""
100
+ <script>
101
+ search("{search_query}");
102
+ </script>
103
+ """, unsafe_allow_html=True)
104
 
105
  # Run the Streamlit app
106
  if __name__ == "__main__":