Spaces:
Running
Running
Farhan1572
commited on
Commit
•
dcf3cfa
1
Parent(s):
b65b50d
Update app.py
Browse files
app.py
CHANGED
@@ -4,19 +4,130 @@ import os
|
|
4 |
|
5 |
api_key = os.getenv("OPENAI_API_KEY")
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
|
9 |
-
client = OpenAI(api_key = api_key)
|
10 |
|
11 |
-
finetuned_model = "ft:gpt-3.5-turbo-0125:cedarbyte-business-solutions::
|
12 |
|
13 |
def humanize_text(AI_text):
|
14 |
"""Humanizes the provided AI text using the fine-tuned model."""
|
15 |
response = completion = client.chat.completions.create(
|
16 |
model=finetuned_model,
|
17 |
messages=[
|
18 |
-
{"role": "system", "content": "
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
]
|
21 |
)
|
22 |
|
|
|
4 |
|
5 |
api_key = os.getenv("OPENAI_API_KEY")
|
6 |
|
7 |
+
client = OpenAI(api_key = api_key)
|
8 |
+
|
9 |
+
list_of_ai_words = ['Advancement in the realm', 'Aims to bridge',
|
10 |
+
'Aims to democratize',
|
11 |
+
'Aims to foster innovation and collaboration',
|
12 |
+
'Becomes increasingly evident', 'Behind the Veil',
|
13 |
+
'Breaking barriers',
|
14 |
+
'Breakthrough has the potential to revolutionize the way',
|
15 |
+
'Bringing us', 'Bringing us closer to a future',
|
16 |
+
'By combining the capabilities', 'By harnessing the power',
|
17 |
+
'Capturing the attention', 'Continue to advance',
|
18 |
+
'Continue to make significant strides',
|
19 |
+
'Continue to push the boundaries', 'Continues to progress rapidly',
|
20 |
+
'Crucial to be mindful', 'Crucially', 'Cutting-edge',
|
21 |
+
'Drive the next big',
|
22 |
+
'Encompasses a wide range of real-life scenarios',
|
23 |
+
'Enhancement further enhances', 'Ensures that even',
|
24 |
+
'Essential to understand the nuances', 'Excitement',
|
25 |
+
'Exciting opportunities', 'Exciting possibilities',
|
26 |
+
'Exciting times lie ahead as we unlock the potential of',
|
27 |
+
'Excitingly', 'Expanded its capabilities',
|
28 |
+
'Expect to witness transformative breakthroughs',
|
29 |
+
'Expect to witness transformative breakthroughs in their capabilities',
|
30 |
+
'Exploration of various potential answers',
|
31 |
+
'Explore the fascinating world', 'Exploring new frontiers',
|
32 |
+
'Exploring this avenue', 'Foster the development',
|
33 |
+
'Future might see us placing', 'Groundbreaking way',
|
34 |
+
'Groundbreaking advancement', 'Groundbreaking study',
|
35 |
+
'Groundbreaking technology',
|
36 |
+
'Have come a long way in recent years', 'Hold promise',
|
37 |
+
'Implications are profound',
|
38 |
+
'Improved efficiency in countless ways', 'In conclusion',
|
39 |
+
'In the fast-paced world', 'Innovative service',
|
40 |
+
'Intrinsic differences', 'It discovered an intriguing approach',
|
41 |
+
'It remains to be seen',
|
42 |
+
'It serves as a stepping stone towards the realization',
|
43 |
+
'Latest breakthrough signifies', 'Latest offering',
|
44 |
+
'Let’s delve into the exciting details',
|
45 |
+
'Main message to take away', 'Make informed decisions',
|
46 |
+
'Mark a significant step forward', 'Mind-boggling figure',
|
47 |
+
'More robust evaluation', 'Navigate the landscape', 'Notably',
|
48 |
+
'One step closer', 'One thing is clear', 'Only time will tell',
|
49 |
+
'Opens up exciting possibilities',
|
50 |
+
'Paving the way for enhanced performance',
|
51 |
+
'Possibilities are endless', 'Potentially revolutionizing the way',
|
52 |
+
'Push the boundaries', 'Raise fairness concerns',
|
53 |
+
'Raise intriguing questions', 'Rapid pace of development',
|
54 |
+
'Rapidly developing', 'Redefine the future',
|
55 |
+
'Remarkable abilities', 'Remarkable breakthrough',
|
56 |
+
'Remarkable proficiency', 'Remarkable success', 'Remarkable tool',
|
57 |
+
'Remarkably', 'Renowned', 'Represent a major milestone',
|
58 |
+
'Represents a significant milestone in the field',
|
59 |
+
'Revolutionize the way', 'Revolutionizing the way',
|
60 |
+
'Risks of drawing unsupported conclusions',
|
61 |
+
'Seeking trustworthiness', 'Significant step forward',
|
62 |
+
'Significant strides', 'The necessity of clear understanding',
|
63 |
+
'There is still room for improvement', 'Transformative power',
|
64 |
+
'Truly exciting', 'Uncover hidden trends',
|
65 |
+
'Understanding of the capabilities', 'Unleashing the potential',
|
66 |
+
'Unlocking the power', 'Unraveling',
|
67 |
+
'We can improve understanding and decision-making',
|
68 |
+
'Welcome your thoughts', 'What sets this apart', 'What’s more',
|
69 |
+
'With the introduction', 'Amazing', 'Disruptive', 'Remarkable',
|
70 |
+
'Breakthrough', 'Paving the way', 'State-of-the-art',
|
71 |
+
'The rapid pace of development', 'Unprecedented', 'Revolutionary',
|
72 |
+
'Innovative', 'Revolutionize the way...',
|
73 |
+
'Significantly enhances...', 'Bringing us one step closer',
|
74 |
+
'Next-generation', 'Remember', 'Dive', 'Dazzling', 'Enhance',
|
75 |
+
'Discover', 'Divine', 'Unveiling', 'Comprehensive',
|
76 |
+
'Inquire', 'Discern', 'Vigilance', 'In conclusion',
|
77 |
+
'Embark', 'Journey', 'Elevate', 'Evolution', 'Shift',
|
78 |
+
'Prevailing', 'Unleash',
|
79 |
+
'Let us embark on a journey of', 'Facilitate',
|
80 |
+
'Unveil', 'Elucidate', 'Leverage', 'Utilize',
|
81 |
+
'Strategize', 'Innovate', 'Synthesize', 'Expedite',
|
82 |
+
'Cultivate', 'Delineate', 'Articulate', 'Navigate',
|
83 |
+
'Proliferate', 'Augment', 'Diversify', 'Conceptualize',
|
84 |
+
'Manifest', 'Ponder', 'Scrutinize', 'Elicit',
|
85 |
+
'Enumerate', 'Empower', 'Disseminate', 'Culminate',
|
86 |
+
'Harness', 'Perceive', 'Actualize', 'Harmonize',
|
87 |
+
'Accentuate', 'Illuminate', 'Reiterate', 'Mitigate',
|
88 |
+
'Galvanize', 'Transcend', 'Advocate', 'Exemplify',
|
89 |
+
'Validate', 'Consolidate', 'Mediate', 'Conjecture',
|
90 |
+
'Ascertain', 'Contextualize', 'Amplify', 'Elaborate',
|
91 |
+
'Synergize', 'Correlate', 'Quantify',
|
92 |
+
'Extrapolate', 'Substantiate', 'Deconstruct', 'Engage',
|
93 |
+
'Envision', 'Speculate', 'Expound', 'Interpret',
|
94 |
+
'Juxtapose', 'Encompass', 'Revitalize',
|
95 |
+
'Assimilate', 'Collaborate', 'Deliberate',
|
96 |
+
'Aggregate', 'Fortify', 'Acclimate', 'Differentiate',
|
97 |
+
'Reconcile', 'Decipher', 'Theorize', 'Alleviate',
|
98 |
+
'Align', 'Dissect', 'Formulate', 'Evaluate',
|
99 |
+
'Converge', 'Introspect', 'Scaffold', 'Emulate',
|
100 |
+
'Reconfigure', 'Incubate', 'Permeate', 'Benchmark',
|
101 |
+
'Calibrate', 'Recapitulate', 'Orchestrate',
|
102 |
+
'Retrofit', 'Transmute', 'Delve', 'Furthermore', 'Tapestry',
|
103 |
+
'consequently', 'in addition to', 'extremely', 'significantly',
|
104 |
+
"In today's world", 'embarked', 'invaluable', 'relentless',
|
105 |
+
'groundbreaking', 'endeavor', 'enlightening', 'insights',
|
106 |
+
'esteemed', 'shed light', 'in the realm of',
|
107 |
+
'deep understanding', 'deliving', 'unlock', 'unleash', 'foster',
|
108 |
+
'Intricate', 'interplay', 'hurdle', 'Dive deep', 'bespoke',
|
109 |
+
'Nevertheless', 'Ultimately', 'pivotal', 'adhere', 'amplify',
|
110 |
+
'Absolutely', 'Its important to note', 'overall',
|
111 |
+
'due to the fact that', 'fostering', 'A tapestry of', 'All about',
|
112 |
+
'This is about']
|
113 |
|
114 |
|
|
|
115 |
|
116 |
+
finetuned_model = "ft:gpt-3.5-turbo-0125:cedarbyte-business-solutions::9PRHsQbf"
|
117 |
|
118 |
def humanize_text(AI_text):
|
119 |
"""Humanizes the provided AI text using the fine-tuned model."""
|
120 |
response = completion = client.chat.completions.create(
|
121 |
model=finetuned_model,
|
122 |
messages=[
|
123 |
+
{"role": "system", "content": """
|
124 |
+
You are a text humanizer.
|
125 |
+
You humanize AI generated text.
|
126 |
+
The text must appear like humanly written.
|
127 |
+
THE INPUT AND THE OUTPUT TEXT SHOULD HAVE THE SAME FORMAT.
|
128 |
+
THE HEADINGS AND THE BULLETS IN THE INPUT SHOULD REMAIN IN PLACE"""},
|
129 |
+
{"role": "user", "content": f"Your output SHOULD NOT CONTAIN ANY OF THE WORD FROM THE LIST OF WORDS: {list_of_ai_words}"},
|
130 |
+
{"role": "user", "content": f"Humanize the text. Keep the output format i.e. the bullets and the headings as it is and dont use the list of words that are not permissible. \nTEXT: {AI_text}"}
|
131 |
]
|
132 |
)
|
133 |
|