File size: 3,977 Bytes
a18afa5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import gradio as gr
import random
import json
tarot_data = {
    "The Fool": {
        "keywords": "New beginnings, innocence, spontaneity",
        "description": "A young person standing on a cliff, with a small dog at their feet",
        "upright": "Taking a leap of faith, being spontaneous, following your heart",
        "reversed": "Recklessness, foolishness, risk-taking",
        "advice": "Trust your instincts and take that first step",
        "color": "Yellow",
        "symbols": "White rose, mountains, dog"
    },
    "The Magician": {
        "keywords": "Manifestation, resourcefulness, power",
        "description": "A figure with one arm raised holding a wand, symbols of all suits on table",
        "upright": "Power, skill, concentration, action, resourcefulness",
        "reversed": "Manipulation, poor planning, untapped talents",
        "advice": "You have all the tools - use them wisely",
        "color": "Red",
        "symbols": "Infinity sign, wand, elements"
    },
    "The High Priestess": {
        "keywords": "Intuition, mystery, spirituality",
        "description": "A woman sitting between two pillars with a crescent moon",
        "upright": "Inner voice, unconscious knowledge, mystery",
        "reversed": "Secrets, disconnected from intuition",
        "advice": "Listen to your inner voice",
        "color": "Blue",
        "symbols": "Crescent moon, pillars, pomegranates"
    },
    "The Empress": {
        "keywords": "Abundance, nurturing, fertility",
        "description": "A woman in a flowing dress surrounded by nature",
        "upright": "Abundance, nurturing, fertility, feminine energy",
        "reversed": "Creative block, neglect, nature",
        "advice": "Embrace your nurturing side",
        "color": "Green",
        "symbols": "Stars, flowing water, heart"
    },
    "The Emperor": {
        "keywords": "Authority, structure, leadership",
        "description": "A stern figure seated on a throne decorated with rams",
        "upright": "Authority, structure, control, fatherhood",
        "reversed": "Tyranny, rigidity, lack of discipline",
        "advice": "Take charge and establish order",
        "color": "Red",
        "symbols": "Rams, ankh, orb"
    }
}
def get_random_cards(num_cards):
    cards = list(tarot_data.keys())
    return random.sample(cards, min(num_cards, len(cards)))
def format_reading(card_name):
    card = tarot_data[card_name]
    reading = (
        f"๐ŸŽด {card_name}\n\n"
        f"๐ŸŒˆ Description: {card['description']}\n\n"
        f"โœจ Keywords: {card['keywords']}\n\n"
        f"๐Ÿ”ฎ Upright: {card['upright']}\n"
        f"๐Ÿ”„ Reversed: {card['reversed']}\n\n"
        f"โšก Advice: {card['advice']}\n\n"
        f"๐ŸŽจ Color Energy: {card['color']}\n"
        f"๐Ÿ’ซ Key Symbols: {card['symbols']}\n"
        f"-------------------\n\n"
    )
    return reading
def tarot_reading(question, num_cards):
    if not question:
        return "Please ask a question for your reading."
    selected_cards = get_random_cards(num_cards)
    response = f"๐Ÿ”ฎ Reading for your question: {question}\n\n"
    response += "โœจ The cards have revealed:\n\n"
    for i, card in enumerate(selected_cards, 1):
        response += f"Card {i}:\n{format_reading(card)}"
    response += "\n๐ŸŒŸ Final Guidance: Trust in the wisdom of the cards and follow your intuition."
    return response
interface = gr.Interface(
    fn=tarot_reading,
    inputs=[
        gr.Textbox(label="What question would you like to ask the cards?", placeholder="Enter your question here..."),
        gr.Slider(minimum=1, maximum=5, value=3, step=1, label="Number of cards (1-5)")
    ],
    outputs=gr.Textbox(label="Your Tarot Reading", lines=20),
    title="๐Ÿ”ฎ Mystic Tarot Reading",
    theme=gr.themes.Soft(),
    css=".gradio-container {background-color: #2D3250;} .gradio-interface {border-radius: 15px; padding: 20px;}"
)
interface.launch()

if __name__ == '__main__':
    demo.launch()