Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import streamlit.components.v1 as components
|
| 3 |
+
|
| 4 |
+
# Title of the Streamlit app
|
| 5 |
+
st.title("Simple Streamlit App with HTML, CSS, and JavaScript")
|
| 6 |
+
|
| 7 |
+
# HTML, CSS, and JavaScript content
|
| 8 |
+
html_code = """
|
| 9 |
+
<!DOCTYPE html>
|
| 10 |
+
<html>
|
| 11 |
+
<head>
|
| 12 |
+
<style>
|
| 13 |
+
/* CSS for styling */
|
| 14 |
+
body {
|
| 15 |
+
font-family: Arial, sans-serif;
|
| 16 |
+
margin: 0;
|
| 17 |
+
padding: 0;
|
| 18 |
+
background-color: #f0f0f0;
|
| 19 |
+
}
|
| 20 |
+
h1 {
|
| 21 |
+
color: #4CAF50;
|
| 22 |
+
text-align: center;
|
| 23 |
+
}
|
| 24 |
+
.button {
|
| 25 |
+
display: block;
|
| 26 |
+
width: 200px;
|
| 27 |
+
margin: 20px auto;
|
| 28 |
+
padding: 10px 20px;
|
| 29 |
+
text-align: center;
|
| 30 |
+
color: white;
|
| 31 |
+
background-color: #4CAF50;
|
| 32 |
+
border: none;
|
| 33 |
+
border-radius: 5px;
|
| 34 |
+
cursor: pointer;
|
| 35 |
+
}
|
| 36 |
+
.button:hover {
|
| 37 |
+
background-color: #45a049;
|
| 38 |
+
}
|
| 39 |
+
</style>
|
| 40 |
+
</head>
|
| 41 |
+
<body>
|
| 42 |
+
<h1>Welcome to My Streamlit App!</h1>
|
| 43 |
+
<button class="button" onclick="displayMessage()">Click Me</button>
|
| 44 |
+
<p id="message" style="text-align: center;"></p>
|
| 45 |
+
|
| 46 |
+
<script>
|
| 47 |
+
// JavaScript for interactivity
|
| 48 |
+
function displayMessage() {
|
| 49 |
+
document.getElementById("message").innerHTML = "You clicked the button!";
|
| 50 |
+
}
|
| 51 |
+
</script>
|
| 52 |
+
</body>
|
| 53 |
+
</html>
|
| 54 |
+
"""
|
| 55 |
+
|
| 56 |
+
# Embed HTML, CSS, and JS in the Streamlit app
|
| 57 |
+
components.html(html_code, height=400)
|