Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -9,19 +9,64 @@ st.set_page_config(
|
|
9 |
layout="wide"
|
10 |
)
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
# Custom CSS for better design
|
15 |
-
st.markdown(
|
16 |
-
"""
|
17 |
<style>
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
</style>
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
25 |
|
26 |
# Default Python code template
|
27 |
default_code = '''# Write your Python code here
|
@@ -45,8 +90,8 @@ if st.button("▶ Run Code"):
|
|
45 |
with st.spinner("Running your code..."):
|
46 |
try:
|
47 |
# Send code to backend
|
48 |
-
API_URL = "https://your-backend-service.onrender.com/run" #
|
49 |
-
response = requests.post(API_URL, json={"code": code}) #
|
50 |
|
51 |
# Get output
|
52 |
output = response.json().get("output", "Error in execution.")
|
|
|
9 |
layout="wide"
|
10 |
)
|
11 |
|
12 |
+
# Custom CSS for background, text, and tabs
|
13 |
+
tabs_css = """
|
|
|
|
|
|
|
14 |
<style>
|
15 |
+
/* Full-screen background image */
|
16 |
+
.stApp {
|
17 |
+
background: url('https://huggingface.co/spaces/arpita-23/healthcare_recommendations/resolve/main/images/background.jpg') no-repeat center center fixed;
|
18 |
+
background-size: cover;
|
19 |
+
}
|
20 |
+
/* Remove the white background box in header */
|
21 |
+
.stHeader, .stSubheader {
|
22 |
+
background-color: transparent !important;
|
23 |
+
}
|
24 |
+
/* Remove any background box around the text */
|
25 |
+
.stMarkdown, .stTitle, .stText, .stList, .stSubheader {
|
26 |
+
background-color: transparent;
|
27 |
+
color: black !important;
|
28 |
+
font-weight: bold;
|
29 |
+
}
|
30 |
+
/* Custom styling for tabs */
|
31 |
+
.stTabs [data-baseweb="tab-list"] {
|
32 |
+
background-color: white;
|
33 |
+
border-radius: 20px;
|
34 |
+
padding: 5px;
|
35 |
+
box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.1);
|
36 |
+
}
|
37 |
+
.stTabs [data-baseweb="tab"] {
|
38 |
+
color: #B71C1C;
|
39 |
+
font-weight: bold;
|
40 |
+
border-radius: 20px;
|
41 |
+
padding: 10px 20px;
|
42 |
+
}
|
43 |
+
.stTabs [aria-selected="true"] {
|
44 |
+
background-color: #FAE5D3 !important;
|
45 |
+
color: #B71C1C !important;
|
46 |
+
font-weight: bold;
|
47 |
+
}
|
48 |
+
/* Add some padding and styling to text boxes */
|
49 |
+
.stTextInput, .stTextArea {
|
50 |
+
font-size: 16px;
|
51 |
+
padding: 10px;
|
52 |
+
border-radius: 8px;
|
53 |
+
border: 1px solid #ccc;
|
54 |
+
}
|
55 |
+
|
56 |
+
/* Extra styling for textarea and button */
|
57 |
+
.stTextArea textarea {
|
58 |
+
font-size: 16px;
|
59 |
+
font-family: monospace;
|
60 |
+
}
|
61 |
+
.stButton button {
|
62 |
+
background-color: #1E90FF;
|
63 |
+
color: white;
|
64 |
+
}
|
65 |
</style>
|
66 |
+
"""
|
67 |
+
st.markdown(tabs_css, unsafe_allow_html=True)
|
68 |
+
|
69 |
+
st.title("🐍 Online Python Compiler")
|
70 |
|
71 |
# Default Python code template
|
72 |
default_code = '''# Write your Python code here
|
|
|
90 |
with st.spinner("Running your code..."):
|
91 |
try:
|
92 |
# Send code to backend
|
93 |
+
API_URL = "https://your-backend-service.onrender.com/run" # Replace with actual backend URL
|
94 |
+
response = requests.post(API_URL, json={"code": code}) # Make API call
|
95 |
|
96 |
# Get output
|
97 |
output = response.json().get("output", "Error in execution.")
|