Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
def clean_text ( s : str ) -> str :
|
| 3 |
+
s = " \ n " . join ([ line . strip () for line in s . splitlines () if line .
|
| 4 |
+
strip () ])
|
| 5 |
+
s = " " . join ( s . split () )
|
| 6 |
+
return s
|
| 7 |
+
demo = gr . Interface (
|
| 8 |
+
fn = clean_text ,
|
| 9 |
+
inputs = gr . Textbox ( lines =6 , label = " Paste your text " ) ,
|
| 10 |
+
outputs = gr . Textbox ( lines =6 , label = " Cleaned output " ) ,
|
| 11 |
+
title = " Simple Text Cleaner ( Deployed on HF Spaces ) " ,
|
| 12 |
+
description = " A beginner - friendly app hosted on Hugging Face Spaces .
|
| 13 |
+
"
|
| 14 |
+
)
|
| 15 |
+
if __name__ == " __main__ " :
|
| 16 |
+
demo . launch ()
|
| 17 |
+
|