Spaces:
Sleeping
Sleeping
GitHub Actions commited on
Commit ·
bc84d34
1
Parent(s): 5136e53
Deploy Emily Pantheon backend from GitHub Actions
Browse files
app.py
CHANGED
|
@@ -151,17 +151,22 @@ def get_tarot_deck():
|
|
| 151 |
|
| 152 |
@app.post("/tarot/read")
|
| 153 |
def read_tarot(request: TarotRequest):
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
|
| 166 |
|
| 167 |
@app.post("/fengshui/analyze")
|
|
|
|
| 151 |
|
| 152 |
@app.post("/tarot/read")
|
| 153 |
def read_tarot(request: TarotRequest):
|
| 154 |
+
try:
|
| 155 |
+
lang = normalize_lang(request.lang)
|
| 156 |
+
system = get_dynamic_persona(lang, "tarot")
|
| 157 |
+
cards_text = ", ".join(request.cards)
|
| 158 |
+
user = (
|
| 159 |
+
f"Topic: {request.topic}\n"
|
| 160 |
+
f"Selected cards: {cards_text}\n"
|
| 161 |
+
f"Question: {request.query}\n\n"
|
| 162 |
+
f"Give a tarot reading as Emily. Interpret each card for this topic and weave them together."
|
| 163 |
+
)
|
| 164 |
+
result = _call_llm(system, user)
|
| 165 |
+
return {"result": result}
|
| 166 |
+
except HTTPException:
|
| 167 |
+
raise
|
| 168 |
+
except Exception as exc:
|
| 169 |
+
raise HTTPException(status_code=502, detail=str(exc)) from exc
|
| 170 |
|
| 171 |
|
| 172 |
@app.post("/fengshui/analyze")
|