Spaces:
Sleeping
Sleeping
Lcmind commited on
Commit ·
74dc6b0
1
Parent(s): b895841
fix: S-tier prompt - hex to color name, blur UI text, remove watermarks
Browse files- app/services/qwen.py +5 -0
app/services/qwen.py
CHANGED
|
@@ -75,6 +75,8 @@ Extract key information to create a poster that VISUALLY REPRESENTS what this co
|
|
| 75 |
result = response.json()
|
| 76 |
# Qwen-VL은 답변이 result['answer']에 들어있음
|
| 77 |
text = result.get("answer", "").strip()
|
|
|
|
|
|
|
| 78 |
|
| 79 |
# 기존 JSON 파싱 로직 재사용
|
| 80 |
if "```json" in text:
|
|
@@ -84,11 +86,14 @@ Extract key information to create a poster that VISUALLY REPRESENTS what this co
|
|
| 84 |
text = text[text.find('{'):text.rfind('}')+1]
|
| 85 |
try:
|
| 86 |
analysis = json.loads(text)
|
|
|
|
| 87 |
return analysis
|
| 88 |
except json.JSONDecodeError as e:
|
| 89 |
text = text.replace("'", '"').replace('\n', ' ')
|
| 90 |
try:
|
| 91 |
analysis = json.loads(text)
|
|
|
|
| 92 |
return analysis
|
| 93 |
except:
|
|
|
|
| 94 |
raise Exception(f"Failed to parse Qwen response as JSON: {text[:200]}")
|
|
|
|
| 75 |
result = response.json()
|
| 76 |
# Qwen-VL은 답변이 result['answer']에 들어있음
|
| 77 |
text = result.get("answer", "").strip()
|
| 78 |
+
print("[QWEN RAW RESPONSE]", result)
|
| 79 |
+
print("[QWEN ANSWER TEXT]", text)
|
| 80 |
|
| 81 |
# 기존 JSON 파싱 로직 재사용
|
| 82 |
if "```json" in text:
|
|
|
|
| 86 |
text = text[text.find('{'):text.rfind('}')+1]
|
| 87 |
try:
|
| 88 |
analysis = json.loads(text)
|
| 89 |
+
print("[QWEN PARSED ANALYSIS]", analysis)
|
| 90 |
return analysis
|
| 91 |
except json.JSONDecodeError as e:
|
| 92 |
text = text.replace("'", '"').replace('\n', ' ')
|
| 93 |
try:
|
| 94 |
analysis = json.loads(text)
|
| 95 |
+
print("[QWEN PARSED ANALYSIS - RETRY]", analysis)
|
| 96 |
return analysis
|
| 97 |
except:
|
| 98 |
+
print("[QWEN PARSE ERROR]", text[:200])
|
| 99 |
raise Exception(f"Failed to parse Qwen response as JSON: {text[:200]}")
|