Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -144,44 +144,9 @@ def get_reading(question, selected_cards):
|
|
144 |
return result + "\n\n๐ May these insights guide your path! ๐"
|
145 |
|
146 |
|
147 |
-
# ... (์ด์
|
148 |
|
149 |
-
|
150 |
-
fn=get_reading,
|
151 |
-
inputs=[
|
152 |
-
gr.Textbox(
|
153 |
-
label="๐ค What would you like to know?",
|
154 |
-
placeholder="Enter your question here...",
|
155 |
-
lines=3
|
156 |
-
),
|
157 |
-
gr.CheckboxGroup( # CheckboxGroup์ผ๋ก ์์
|
158 |
-
choices=list(tarot_cards.keys()),
|
159 |
-
label="๐ด Select Your Cards (Max 5)",
|
160 |
-
info="Choose 1-5 cards for your reading"
|
161 |
-
)
|
162 |
-
],
|
163 |
-
outputs=gr.Textbox(
|
164 |
-
label="๐ฎ Your Mystical Reading",
|
165 |
-
lines=20
|
166 |
-
),
|
167 |
-
title="โจ Mystical Tarot Reading Experience โจ",
|
168 |
-
description="""
|
169 |
-
๐ Welcome to Your Personal Tarot Journey ๐
|
170 |
-
|
171 |
-
๐ด How to Use:
|
172 |
-
1. ๐ญ Focus on your question
|
173 |
-
2. ๐ Select 1-5 cards that call to you
|
174 |
-
3. ๐ Receive your personalized mystical reading
|
175 |
-
|
176 |
-
๐ Let the ancient wisdom guide your path ๐
|
177 |
-
""",
|
178 |
-
article="""
|
179 |
-
<div style="text-align: center;">
|
180 |
-
<a href="https://visitorbadge.io/status?path=https%3A%2F%2Fopenfree-tarotcard.hf.space">
|
181 |
-
<img src="https://api.visitorbadge.io/api/visitors?path=https%3A%2F%2Fopenfree-tarotcard.hf.space&countColor=%23263759" />
|
182 |
-
</a>
|
183 |
-
</div>
|
184 |
-
""",
|
185 |
theme=gr.themes.Soft(
|
186 |
primary_hue="purple",
|
187 |
secondary_hue="pink",
|
@@ -209,29 +174,71 @@ demo = gr.Interface(
|
|
209 |
padding: 20px;
|
210 |
}
|
211 |
"""
|
212 |
-
)
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
)
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
|
236 |
if __name__ == "__main__":
|
237 |
demo.launch(share=True)
|
|
|
144 |
return result + "\n\n๐ May these insights guide your path! ๐"
|
145 |
|
146 |
|
147 |
+
# ... (์ด์ tarot_cards ๋์
๋๋ฆฌ์ get_reading ํจ์๋ ๋์ผ)
|
148 |
|
149 |
+
with gr.Blocks(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
theme=gr.themes.Soft(
|
151 |
primary_hue="purple",
|
152 |
secondary_hue="pink",
|
|
|
174 |
padding: 20px;
|
175 |
}
|
176 |
"""
|
177 |
+
) as demo:
|
178 |
+
gr.HTML("""<h1 style='text-align: center'>โจ Mystical Tarot Reading Experience โจ</h1>""")
|
179 |
+
|
180 |
+
gr.HTML("""
|
181 |
+
<div style='text-align: center'>
|
182 |
+
๐ Welcome to Your Personal Tarot Journey ๐<br><br>
|
183 |
+
๐ด How to Use:<br>
|
184 |
+
1. ๐ญ Focus on your question<br>
|
185 |
+
2. ๐ Select 1-5 cards that call to you<br>
|
186 |
+
3. ๐ Receive your personalized mystical reading<br><br>
|
187 |
+
๐ Let the ancient wisdom guide your path ๐
|
188 |
+
</div>
|
189 |
+
""")
|
190 |
+
|
191 |
+
with gr.Row():
|
192 |
+
with gr.Column():
|
193 |
+
question = gr.Textbox(
|
194 |
+
label="๐ค What would you like to know?",
|
195 |
+
placeholder="Enter your question here...",
|
196 |
+
lines=3
|
197 |
+
)
|
198 |
+
cards = gr.CheckboxGroup(
|
199 |
+
choices=list(tarot_cards.keys()),
|
200 |
+
label="๐ด Select Your Cards (Max 5)",
|
201 |
+
info="Choose 1-5 cards for your reading"
|
202 |
+
)
|
203 |
+
submit_btn = gr.Button("๐ฎ Get Your Reading", variant="primary")
|
204 |
+
|
205 |
+
with gr.Column():
|
206 |
+
output = gr.Textbox(
|
207 |
+
label="๐ฎ Your Mystical Reading",
|
208 |
+
lines=20
|
209 |
+
)
|
210 |
+
|
211 |
+
def validate_and_read(question, selected_cards):
|
212 |
+
if not selected_cards:
|
213 |
+
return "โ ๏ธ Please select at least one card for your reading."
|
214 |
+
if len(selected_cards) > 5:
|
215 |
+
selected_cards = selected_cards[:5]
|
216 |
+
return get_reading(question, selected_cards)
|
217 |
+
|
218 |
+
submit_btn.click(
|
219 |
+
fn=validate_and_read,
|
220 |
+
inputs=[question, cards],
|
221 |
+
outputs=output
|
222 |
+
)
|
223 |
+
|
224 |
+
# Examples
|
225 |
+
gr.Examples(
|
226 |
+
examples=[
|
227 |
+
["What energies surround my current path? ๐ฃ๏ธ", ["โจ The Fool โจ", "๐ฏ The Magician ๐ฏ"]],
|
228 |
+
["What should I know about my love life? โค๏ธ", ["โค๏ธ The Lovers โค๏ธ", "๐บ The Empress ๐บ"]],
|
229 |
+
["Guide me about my career decisions ๐ผ", ["โ๏ธ The Emperor โ๏ธ", "๐ก Wheel of Fortune ๐ก"]],
|
230 |
+
["What's my spiritual lesson for this month? ๐", ["๐๏ธ The Hierophant ๐๏ธ", "๐ฎ The Hermit ๐ฎ", "โญ The Star โญ"]]
|
231 |
+
],
|
232 |
+
inputs=[question, cards]
|
233 |
+
)
|
234 |
+
|
235 |
+
gr.HTML("""
|
236 |
+
<div style="text-align: center; margin-top: 20px;">
|
237 |
+
<a href="https://visitorbadge.io/status?path=https%3A%2F%2Fopenfree-tarotcard.hf.space">
|
238 |
+
<img src="https://api.visitorbadge.io/api/visitors?path=https%3A%2F%2Fopenfree-tarotcard.hf.space&countColor=%23263759" />
|
239 |
+
</a>
|
240 |
+
</div>
|
241 |
+
""")
|
242 |
|
243 |
if __name__ == "__main__":
|
244 |
demo.launch(share=True)
|