yongdong commited on
Commit
5778229
·
1 Parent(s): 9720765

feat: enforce JSON-only output in generate_response_gpu prompt

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -108,9 +108,10 @@ def generate_response_gpu(prompt, max_tokens=200, temperature=0.7, top_p=0.9):
108
  return "❌ Model failed to load. Please check the Space logs."
109
 
110
  try:
111
- # Format input
112
  formatted_prompt = (
113
- f"### Instruction:\n{prompt.strip()}\n\n"
 
 
114
  "### Response:\n"
115
  )
116
 
 
108
  return "❌ Model failed to load. Please check the Space logs."
109
 
110
  try:
 
111
  formatted_prompt = (
112
+ "You are a JSON generator. Please output only a valid JSON object and no additional text.\n\n"
113
+ "### Instruction:\n"
114
+ f"{prompt.strip()}\n\n"
115
  "### Response:\n"
116
  )
117