Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -1,46 +1,16 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from
|
| 3 |
|
| 4 |
-
|
| 5 |
-
model_name = "authormist/authormist-originality"
|
| 6 |
-
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 7 |
-
model = AutoModelForCausalLM.from_pretrained(model_name)
|
| 8 |
|
| 9 |
-
def
|
| 10 |
-
|
| 11 |
-
paras = [p.strip() for p in sop_text.split("\n\n") if p.strip()]
|
| 12 |
-
humanized = []
|
| 13 |
-
|
| 14 |
-
for p in paras:
|
| 15 |
-
# 2. Strong, guiding prompt
|
| 16 |
-
prompt = (
|
| 17 |
-
"You are a senior design student helping me rewrite my Statement of Purpose paragraph. "
|
| 18 |
-
"Make it sound genuine, personal, and conversational—avoid anything too polished or robotic:\n\n"
|
| 19 |
-
f"{p}\n\nHumanized:"
|
| 20 |
-
)
|
| 21 |
-
inputs = tokenizer(prompt, return_tensors="pt")
|
| 22 |
-
outputs = model.generate(
|
| 23 |
-
inputs.input_ids,
|
| 24 |
-
max_new_tokens=256,
|
| 25 |
-
temperature=0.85,
|
| 26 |
-
top_p=0.96,
|
| 27 |
-
do_sample=True
|
| 28 |
-
)
|
| 29 |
-
text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 30 |
-
# 3. Strip off the prompt header and cleanup
|
| 31 |
-
text = text.replace("Humanized:", "").strip()
|
| 32 |
-
humanized.append(text)
|
| 33 |
-
|
| 34 |
-
# 4. Re-join paragraphs with blank lines
|
| 35 |
-
return "\n\n".join(humanized)
|
| 36 |
|
| 37 |
demo = gr.Interface(
|
| 38 |
-
fn=
|
| 39 |
-
inputs=
|
| 40 |
outputs="textbox",
|
| 41 |
-
title="AuthorMist
|
| 42 |
-
description="Rewrite your entire SOP paragraph-by-paragraph into a natural, undetectable tone."
|
| 43 |
)
|
| 44 |
|
| 45 |
-
|
| 46 |
-
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from authormist import Humanizer
|
| 3 |
|
| 4 |
+
humanizer = Humanizer()
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
+
def humanize(text):
|
| 7 |
+
return humanizer.humanize(text)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
demo = gr.Interface(
|
| 10 |
+
fn=humanize,
|
| 11 |
+
inputs="textbox",
|
| 12 |
outputs="textbox",
|
| 13 |
+
title="AuthorMist AI Humanizer"
|
|
|
|
| 14 |
)
|
| 15 |
|
| 16 |
+
demo.launch()
|
|
|