Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,7 @@
|
|
| 2 |
import gradio as gr
|
| 3 |
from openai import OpenAI
|
| 4 |
import os
|
|
|
|
| 5 |
|
| 6 |
# define the openai key
|
| 7 |
api_key = os.getenv("OPENAI_API_KEY")
|
|
@@ -31,8 +32,10 @@ def humanize_text(AI_text):
|
|
| 31 |
]
|
| 32 |
)
|
| 33 |
|
|
|
|
|
|
|
| 34 |
|
| 35 |
-
return
|
| 36 |
|
| 37 |
|
| 38 |
# Gradio interface definition
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
from openai import OpenAI
|
| 4 |
import os
|
| 5 |
+
import re
|
| 6 |
|
| 7 |
# define the openai key
|
| 8 |
api_key = os.getenv("OPENAI_API_KEY")
|
|
|
|
| 32 |
]
|
| 33 |
)
|
| 34 |
|
| 35 |
+
humanize_text= response.choices[0].message.content.strip()
|
| 36 |
+
humanized_text = re.sub(r'[^A-Za-z0-9\s]', '', humanized_text)
|
| 37 |
|
| 38 |
+
return humanized_text
|
| 39 |
|
| 40 |
|
| 41 |
# Gradio interface definition
|