Spaces:
Sleeping
Sleeping
MilanCalegari
commited on
Commit
·
5344f5d
1
Parent(s):
77febf0
fix: update layout
Browse files- app.py +3 -17
- modules/utils/commom.py +3 -3
app.py
CHANGED
|
@@ -7,28 +7,12 @@ from modules.llm.card_interpreter import CardInterpreter
|
|
| 7 |
from modules.tarot.card import TarotDeck
|
| 8 |
from modules.utils.commom import CardReadingMethod, label4method
|
| 9 |
|
| 10 |
-
# Usar o mesmo método de obtenção do caminho base
|
| 11 |
base_dir = os.path.dirname(os.path.abspath(__file__))
|
| 12 |
data_dir = os.path.join(base_dir, "data")
|
| 13 |
json_file = os.path.join(data_dir, "tarot-images.json")
|
| 14 |
|
| 15 |
-
print(f"App base directory: {base_dir}")
|
| 16 |
-
print(f"App data directory: {data_dir}")
|
| 17 |
-
print(f"App looking for JSON file at: {json_file}")
|
| 18 |
|
| 19 |
-
|
| 20 |
-
try:
|
| 21 |
-
print("Attempting to download cards...")
|
| 22 |
-
get_cards()
|
| 23 |
-
print("Cards downloaded successfully")
|
| 24 |
-
|
| 25 |
-
if not os.path.exists(json_file):
|
| 26 |
-
raise FileNotFoundError(f"JSON file not found at {json_file}")
|
| 27 |
-
|
| 28 |
-
except Exception as e:
|
| 29 |
-
st.error(f"Error downloading tarot data: {str(e)}")
|
| 30 |
-
print(f"Detailed error: {e}")
|
| 31 |
-
st.stop()
|
| 32 |
|
| 33 |
# Initialize deck and interpreter
|
| 34 |
deck = TarotDeck()
|
|
@@ -41,6 +25,8 @@ st.title("🔮 Tarot Reading")
|
|
| 41 |
|
| 42 |
# Secret configurations
|
| 43 |
with st.sidebar:
|
|
|
|
|
|
|
| 44 |
with st.expander("⚙️ Settings", expanded=False):
|
| 45 |
reversed_prob = st.slider(
|
| 46 |
"Probability of reversed cards",
|
|
|
|
| 7 |
from modules.tarot.card import TarotDeck
|
| 8 |
from modules.utils.commom import CardReadingMethod, label4method
|
| 9 |
|
|
|
|
| 10 |
base_dir = os.path.dirname(os.path.abspath(__file__))
|
| 11 |
data_dir = os.path.join(base_dir, "data")
|
| 12 |
json_file = os.path.join(data_dir, "tarot-images.json")
|
| 13 |
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
+
get_cards()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
# Initialize deck and interpreter
|
| 18 |
deck = TarotDeck()
|
|
|
|
| 25 |
|
| 26 |
# Secret configurations
|
| 27 |
with st.sidebar:
|
| 28 |
+
if 'expander_state' not in st.session_state:
|
| 29 |
+
st.session_state.expander_state = False
|
| 30 |
with st.expander("⚙️ Settings", expanded=False):
|
| 31 |
reversed_prob = st.slider(
|
| 32 |
"Probability of reversed cards",
|
modules/utils/commom.py
CHANGED
|
@@ -9,9 +9,9 @@ class ArcanaType(str, Enum):
|
|
| 9 |
|
| 10 |
|
| 11 |
class CardReadingMethod(str, Enum):
|
| 12 |
-
PAST_PRESENT_FUTURE = "
|
| 13 |
-
CELTIC_CROSS = "
|
| 14 |
-
HAND_OF_ERIS = "
|
| 15 |
|
| 16 |
|
| 17 |
label4method = {
|
|
|
|
| 9 |
|
| 10 |
|
| 11 |
class CardReadingMethod(str, Enum):
|
| 12 |
+
PAST_PRESENT_FUTURE = "Past Present and Future"
|
| 13 |
+
CELTIC_CROSS = "Celtic Cross"
|
| 14 |
+
HAND_OF_ERIS = "Hand of Eris"
|
| 15 |
|
| 16 |
|
| 17 |
label4method = {
|