showme commited on
Commit
71d86ad
·
verified ·
1 Parent(s): 03c87c4

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +29 -1
main.py CHANGED
@@ -16,7 +16,35 @@ class ContentRequest(BaseModel):
16
 
17
  # Humanize的Prompt
18
  def generate_humanized_content(content: str) -> str:
19
- prompt = f"Humanize this content: {content}" # 这里可以根据需要调整Prompt
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  inputs = tokenizer(prompt, return_tensors="pt", padding=True, truncation=True)
21
  output = model.generate(inputs["input_ids"], max_length=512, num_beams=4, early_stopping=True)
22
  return tokenizer.decode(output[0], skip_special_tokens=True)
 
16
 
17
  # Humanize的Prompt
18
  def generate_humanized_content(content: str) -> str:
19
+ prompt = f"""
20
+ You are a skilled writer tasked with rewriting AI-generated text to make it sound more human, engaging, and relatable. Please follow these instructions:
21
+
22
+ **Humanizing Instructions:**
23
+ To generate human-written text or convert AI-written text into humanized content, here are some instructions you can give to a Large Language Model (LLM):
24
+
25
+ 1. Write in a conversational tone: Imagine you're having a discussion with a friend. Use everyday language and avoid jargon or overly formal tone.
26
+ 2. Add personal touches: Include personal anecdotes, emotions, or experiences to make the text more relatable and authentic.
27
+ 3. Use contractions and colloquialisms: Incorporate contractions (e.g., "don't" instead of "do not") and colloquial expressions (e.g., "break a leg") to give the text a more human feel.
28
+ 4. Vary sentence structure: Mix up short and long sentences to create a natural flow, just like human writing.
29
+ 5. Show, don't tell: Instead of stating facts, use descriptive language to paint a picture in the reader's mind.
30
+
31
+ **For converting AI-written text into humanized content**:
32
+ 1. Rewrite in a more conversational tone: Take the AI-written text and rephrase it in a more relaxed, everyday language.
33
+ 2. Add emotional depth: Inject emotions, empathy, or personal experiences to make the text more relatable and engaging.
34
+ 3. Use more descriptive language: Replace generic terms with vivid, descriptive words to add flavor and personality to the text.
35
+ 4. Break up long sentences: Split lengthy sentences into shorter, more manageable ones to improve readability.
36
+ 5. Add idioms and colloquialisms: Incorporate common idioms and colloquial expressions to give the text a more human-like quality.
37
+ 6. Read it aloud: Read the text aloud to ensure it sounds natural and conversational.
38
+
39
+ **Additional Tips**:
40
+ - Use active voice: It's more engaging and easier to read than passive voice.
41
+ - Show vulnerability: Share imperfections, doubts, or fears to make the text more relatable and authentic.
42
+ - Use humor: Humor can help humanize the text and make it more enjoyable to read.
43
+ - Edit and refine: Review the text multiple times to refine the language, tone, and flow.
44
+
45
+ Now, please humanize the following text:
46
+ {content}
47
+ """
48
  inputs = tokenizer(prompt, return_tensors="pt", padding=True, truncation=True)
49
  output = model.generate(inputs["input_ids"], max_length=512, num_beams=4, early_stopping=True)
50
  return tokenizer.decode(output[0], skip_special_tokens=True)