viskav commited on
Commit
db211cb
·
verified ·
1 Parent(s): 887dd23

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -11
app.py CHANGED
@@ -37,15 +37,14 @@ class RequestBody(BaseModel):
37
  # -------------------------------
38
  SYSTEM_PROMPT = """You are an expert academic editor.
39
 
40
- Your task is to rewrite the user's text so that it:
41
- - Reads like natural, human-written English.
42
  - Has clear structure and good flow.
43
- - Uses a formal, academic tone (IEEE-style if technical).
44
- - Fixes grammar, redundancy, and awkward phrasing.
45
- - Preserves all original meaning and technical content.
46
- - Does NOT add new facts, equations, or claims.
47
-
48
- Output only the rewritten text. Do not include explanations or notes.
49
  """
50
 
51
 
@@ -65,11 +64,11 @@ async def humanize(body: RequestBody):
65
  try:
66
  output = llm(
67
  prompt,
68
- max_tokens=256, # lower = faster, enough for paragraph-length
69
- temperature=0.55, # lower temp => more stable / less random
70
  top_p=0.9,
71
  repeat_penalty=1.05,
72
- stop=["</s>", "[USER]", "[SYSTEM]"],
73
  )
74
  result = output["choices"][0]["text"].strip()
75
  return {"result": result}
 
37
  # -------------------------------
38
  SYSTEM_PROMPT = """You are an expert academic editor.
39
 
40
+ Rewrite the user's text so that it:
41
+ - Reads naturally and human-like.
42
  - Has clear structure and good flow.
43
+ - Uses a formal academic tone.
44
+ - Improves grammar, clarity, and coherence.
45
+ - DOES NOT add explanations, apologies, meta comments, or reasoning steps.
46
+ - DOES NOT mention rewriting, editing, IEEE, or instructions.
47
+ - Outputs ONLY the rewritten paragraph and nothing else.
 
48
  """
49
 
50
 
 
64
  try:
65
  output = llm(
66
  prompt,
67
+ max_tokens=160,
68
+ temperature=0.55,
69
  top_p=0.9,
70
  repeat_penalty=1.05,
71
+ stop=["</s>", "[USER]", "[SYSTEM]", "[ASSISTANT]", "[/ASSISTANT]"],
72
  )
73
  result = output["choices"][0]["text"].strip()
74
  return {"result": result}