Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,7 +8,6 @@ from nltk.tokenize import sent_tokenize
|
|
| 8 |
import plotly.express as px
|
| 9 |
import time
|
| 10 |
import tqdm
|
| 11 |
-
|
| 12 |
nltk.download('punkt')
|
| 13 |
|
| 14 |
# Define the device (GPU or CPU)
|
|
@@ -22,11 +21,10 @@ model = AutoModelForSequenceClassification.from_pretrained(checkpoint).to(device
|
|
| 22 |
|
| 23 |
# Define the function for preprocessing text
|
| 24 |
def prep_text(text):
|
| 25 |
-
clean_sents = []
|
| 26 |
-
sent_tokens = str(text)
|
| 27 |
for sent_token in sent_tokens:
|
| 28 |
word_tokens = [str(word_token).strip().lower() for word_token in sent_token.split()]
|
| 29 |
-
word_tokens = [word_token for word_token in word_tokens if word_token not in punctuations]
|
| 30 |
clean_sents.append(' '.join((word_tokens)))
|
| 31 |
joined_clean_sents = '. '.join(clean_sents).strip(' ')
|
| 32 |
return joined_clean_sents
|
|
@@ -45,7 +43,7 @@ def app_info():
|
|
| 45 |
iface1 = gr.Interface(
|
| 46 |
fn=app_info, inputs=None, outputs=['text'], title="General-Infomation",
|
| 47 |
description='''
|
| 48 |
-
This app, powered by the IEQ-BERT model
|
| 49 |
to indoor environmental quality (IEQ). IEQ refers to the quality of the indoor air, lighting,
|
| 50 |
temperature, and acoustics within a building, as well as the overall comfort and well-being of its occupants. It encompasses various
|
| 51 |
factors that can impact the health, productivity, and satisfaction of people who spend time indoors, such as office workers, students,
|
|
|
|
| 8 |
import plotly.express as px
|
| 9 |
import time
|
| 10 |
import tqdm
|
|
|
|
| 11 |
nltk.download('punkt')
|
| 12 |
|
| 13 |
# Define the device (GPU or CPU)
|
|
|
|
| 21 |
|
| 22 |
# Define the function for preprocessing text
|
| 23 |
def prep_text(text):
|
| 24 |
+
clean_sents = []
|
| 25 |
+
sent_tokens = sent_tokenize(str(text))
|
| 26 |
for sent_token in sent_tokens:
|
| 27 |
word_tokens = [str(word_token).strip().lower() for word_token in sent_token.split()]
|
|
|
|
| 28 |
clean_sents.append(' '.join((word_tokens)))
|
| 29 |
joined_clean_sents = '. '.join(clean_sents).strip(' ')
|
| 30 |
return joined_clean_sents
|
|
|
|
| 43 |
iface1 = gr.Interface(
|
| 44 |
fn=app_info, inputs=None, outputs=['text'], title="General-Infomation",
|
| 45 |
description='''
|
| 46 |
+
This app, powered by the IEQ-BERT model, is for automating the classification of text with respect
|
| 47 |
to indoor environmental quality (IEQ). IEQ refers to the quality of the indoor air, lighting,
|
| 48 |
temperature, and acoustics within a building, as well as the overall comfort and well-being of its occupants. It encompasses various
|
| 49 |
factors that can impact the health, productivity, and satisfaction of people who spend time indoors, such as office workers, students,
|