Spaces:
Configuration error
Configuration error
Add gradio demo.py and gradio dependency
Browse files- demo.py +24 -0
- requirements.txt +2 -1
demo.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from model import HumanizeModel
|
| 3 |
+
|
| 4 |
+
model = HumanizeModel()
|
| 5 |
+
|
| 6 |
+
def humanize_text(text):
|
| 7 |
+
if not text.strip():
|
| 8 |
+
return "Please enter some text."
|
| 9 |
+
return model.humanize(text)
|
| 10 |
+
|
| 11 |
+
demo = gr.Interface(
|
| 12 |
+
fn=humanize_text,
|
| 13 |
+
inputs=gr.Textbox(lines=8, placeholder="Paste AI-generated text here...", label="Input"),
|
| 14 |
+
outputs=gr.Textbox(lines=8, label="Humanized Output"),
|
| 15 |
+
title="humanize-e",
|
| 16 |
+
description="Rewrites AI-generated text to sound more natural and human-written. Developed by Mike Elistra. Adapter loads from HUMANIZE_ADAPTER env var.",
|
| 17 |
+
examples=[
|
| 18 |
+
"In order to provide you with a comprehensive solution, it is important to note that we have conducted extensive research.",
|
| 19 |
+
"As an AI language model, I must inform you that the following information is based on publicly available data."
|
| 20 |
+
]
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
+
if __name__ == "__main__":
|
| 24 |
+
demo.launch(server_name="0.0.0.0", server_port=7860)
|
requirements.txt
CHANGED
|
@@ -6,4 +6,5 @@ peft>=0.8.0
|
|
| 6 |
bitsandbytes>=0.43.0
|
| 7 |
fastapi>=0.100.0
|
| 8 |
uvicorn[standard]>=0.23.0
|
| 9 |
-
python-dotenv>=1.0.0
|
|
|
|
|
|
| 6 |
bitsandbytes>=0.43.0
|
| 7 |
fastapi>=0.100.0
|
| 8 |
uvicorn[standard]>=0.23.0
|
| 9 |
+
python-dotenv>=1.0.0
|
| 10 |
+
gradio>=4.28.0
|