bazil3814 commited on
Commit
de45ec7
·
verified ·
1 Parent(s): 8dd9bb1

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +39 -0
app.py ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import random
3
+
4
+ def humanize_text(text):
5
+ # Simple word replacements (can be expanded or replaced with AI model)
6
+ substitutions = {
7
+ "utilize": "use",
8
+ "demonstrate": "show",
9
+ "commence": "start",
10
+ "terminate": "end",
11
+ "in order to": "to",
12
+ "furthermore": "also",
13
+ }
14
+
15
+ for word, replacement in substitutions.items():
16
+ text = text.replace(word, replacement)
17
+
18
+ # Randomize sentence order (basic way to alter structure)
19
+ sentences = [s.strip() for s in text.split('.') if s.strip()]
20
+ random.shuffle(sentences)
21
+ text = '. '.join(sentences) + '.'
22
+
23
+ return text
24
+
25
+ # Streamlit UI
26
+ st.set_page_config(page_title="Humanize AI Text", layout="centered")
27
+
28
+ st.title("🧠 Humanize AI-Generated Text")
29
+ st.write("Paste AI-generated text below and we'll try to make it sound more human.")
30
+
31
+ input_text = st.text_area("Enter AI-Generated Text", height=300)
32
+
33
+ if st.button("Humanize"):
34
+ if input_text.strip() == "":
35
+ st.warning("Please enter some text.")
36
+ else:
37
+ output = humanize_text(input_text)
38
+ st.subheader("Humanized Text")
39
+ st.text_area("Output", value=output, height=300)