Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -56,21 +56,29 @@ def set_background(image_file):
|
|
56 |
color: #ffffff;
|
57 |
text-align: center;
|
58 |
font-size: 3em;
|
59 |
-
font-weight:
|
60 |
margin-bottom: 0.2em;
|
|
|
61 |
}}
|
62 |
.subtitle {{
|
63 |
-
color: #
|
64 |
text-align: center;
|
65 |
-
font-size: 1.
|
66 |
margin-bottom: 0.5em;
|
|
|
67 |
}}
|
68 |
.quote {{
|
69 |
-
color: #
|
70 |
text-align: center;
|
71 |
font-style: italic;
|
72 |
-
font-size: 1.
|
73 |
margin-bottom: 2em;
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
}}
|
75 |
.stButton>button {{
|
76 |
width: 100%;
|
@@ -83,6 +91,51 @@ def set_background(image_file):
|
|
83 |
unsafe_allow_html=True
|
84 |
)
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
def save_text_as_image(text, file_path):
|
87 |
font = ImageFont.load_default()
|
88 |
lines = text.split('\n')
|
|
|
56 |
color: #ffffff;
|
57 |
text-align: center;
|
58 |
font-size: 3em;
|
59 |
+
font-weight: 900;
|
60 |
margin-bottom: 0.2em;
|
61 |
+
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
|
62 |
}}
|
63 |
.subtitle {{
|
64 |
+
color: #f0f0f0;
|
65 |
text-align: center;
|
66 |
+
font-size: 1.4em;
|
67 |
margin-bottom: 0.5em;
|
68 |
+
text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.6);
|
69 |
}}
|
70 |
.quote {{
|
71 |
+
color: #eeeeee;
|
72 |
text-align: center;
|
73 |
font-style: italic;
|
74 |
+
font-size: 1.2em;
|
75 |
margin-bottom: 2em;
|
76 |
+
text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.6);
|
77 |
+
}}
|
78 |
+
h1, h3 {{
|
79 |
+
color: #ffffff !important;
|
80 |
+
text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.8);
|
81 |
+
font-weight: 800;
|
82 |
}}
|
83 |
.stButton>button {{
|
84 |
width: 100%;
|
|
|
91 |
unsafe_allow_html=True
|
92 |
)
|
93 |
|
94 |
+
|
95 |
+
# def set_background(image_file):
|
96 |
+
# with open(image_file, "rb") as image:
|
97 |
+
# encoded = base64.b64encode(image.read()).decode()
|
98 |
+
# st.markdown(
|
99 |
+
# f"""
|
100 |
+
# <style>
|
101 |
+
# .stApp {{
|
102 |
+
# background-image: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)),
|
103 |
+
# url("data:image/jpg;base64,{encoded}");
|
104 |
+
# background-size: cover;
|
105 |
+
# background-repeat: no-repeat;
|
106 |
+
# background-attachment: fixed;
|
107 |
+
# }}
|
108 |
+
# .main-title {{
|
109 |
+
# color: #ffffff;
|
110 |
+
# text-align: center;
|
111 |
+
# font-size: 3em;
|
112 |
+
# font-weight: bold;
|
113 |
+
# margin-bottom: 0.2em;
|
114 |
+
# }}
|
115 |
+
# .subtitle {{
|
116 |
+
# color: #dddddd;
|
117 |
+
# text-align: center;
|
118 |
+
# font-size: 1.3em;
|
119 |
+
# margin-bottom: 0.5em;
|
120 |
+
# }}
|
121 |
+
# .quote {{
|
122 |
+
# color: #bbbbbb;
|
123 |
+
# text-align: center;
|
124 |
+
# font-style: italic;
|
125 |
+
# font-size: 1.1em;
|
126 |
+
# margin-bottom: 2em;
|
127 |
+
# }}
|
128 |
+
# .stButton>button {{
|
129 |
+
# width: 100%;
|
130 |
+
# font-size: 1.1em;
|
131 |
+
# padding: 0.8em;
|
132 |
+
# border-radius: 10px;
|
133 |
+
# }}
|
134 |
+
# </style>
|
135 |
+
# """,
|
136 |
+
# unsafe_allow_html=True
|
137 |
+
# )
|
138 |
+
|
139 |
def save_text_as_image(text, file_path):
|
140 |
font = ImageFont.load_default()
|
141 |
lines = text.split('\n')
|