abdulmatinomotoso
commited on
Commit
·
29f1187
1
Parent(s):
c85007d
Update app.py
Browse files
app.py
CHANGED
@@ -21,7 +21,7 @@ def read_in_text(url):
|
|
21 |
return article
|
22 |
|
23 |
def clean_text(url):
|
24 |
-
text =
|
25 |
text = text.encode("ascii", errors="ignore").decode(
|
26 |
"ascii"
|
27 |
) # remove non-ascii, Chinese characters
|
@@ -40,7 +40,7 @@ def clean_text(url):
|
|
40 |
|
41 |
#Defining a function to get the category of the news article
|
42 |
def get_category(file):
|
43 |
-
text = clean_text(file
|
44 |
|
45 |
input_tensor = tokenizer.encode(text, return_tensors='pt', truncation=True)
|
46 |
logits = model(input_tensor).logits
|
@@ -53,7 +53,7 @@ def get_category(file):
|
|
53 |
return emotion
|
54 |
|
55 |
#Creating the interface for the radio app
|
56 |
-
demo = gr.Interface(get_category, inputs=gr.inputs.
|
57 |
outputs = 'text',
|
58 |
title='News Article Categorization')
|
59 |
|
|
|
21 |
return article
|
22 |
|
23 |
def clean_text(url):
|
24 |
+
text = url
|
25 |
text = text.encode("ascii", errors="ignore").decode(
|
26 |
"ascii"
|
27 |
) # remove non-ascii, Chinese characters
|
|
|
40 |
|
41 |
#Defining a function to get the category of the news article
|
42 |
def get_category(file):
|
43 |
+
text = clean_text(file)
|
44 |
|
45 |
input_tensor = tokenizer.encode(text, return_tensors='pt', truncation=True)
|
46 |
logits = model(input_tensor).logits
|
|
|
53 |
return emotion
|
54 |
|
55 |
#Creating the interface for the radio app
|
56 |
+
demo = gr.Interface(get_category, inputs=gr.inputs.Textbox(label='Drop your articles here'),
|
57 |
outputs = 'text',
|
58 |
title='News Article Categorization')
|
59 |
|