Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -21,7 +21,7 @@ def categorize(input_number):
|
|
21 |
3: 'Politics',
|
22 |
4: 'Sport'
|
23 |
}
|
24 |
-
result = categories.get(input_number)
|
25 |
print('decoded result', result)
|
26 |
return result
|
27 |
|
@@ -92,13 +92,9 @@ def process_api(text):
|
|
92 |
|
93 |
# Using Model to handle and return Category Route
|
94 |
def categorize(url):
|
95 |
-
print("outside try", url)
|
96 |
try:
|
97 |
-
print("inside try", url)
|
98 |
article_content = crawURL(url)
|
99 |
-
print("inside try article_content", article_content)
|
100 |
result = process_api(article_content)
|
101 |
-
print("inside try result", result)
|
102 |
return result
|
103 |
except Exception as error:
|
104 |
if hasattr(error, 'message'):
|
@@ -108,6 +104,7 @@ def categorize(url):
|
|
108 |
|
109 |
# Main App
|
110 |
url = st.text_input("enter your CNN's URL here")
|
|
|
111 |
if url:
|
112 |
result = categorize(url)
|
113 |
st.json(result)
|
|
|
21 |
3: 'Politics',
|
22 |
4: 'Sport'
|
23 |
}
|
24 |
+
result = categories.get(input_number) # Ex: Health
|
25 |
print('decoded result', result)
|
26 |
return result
|
27 |
|
|
|
92 |
|
93 |
# Using Model to handle and return Category Route
|
94 |
def categorize(url):
|
|
|
95 |
try:
|
|
|
96 |
article_content = crawURL(url)
|
|
|
97 |
result = process_api(article_content)
|
|
|
98 |
return result
|
99 |
except Exception as error:
|
100 |
if hasattr(error, 'message'):
|
|
|
104 |
|
105 |
# Main App
|
106 |
url = st.text_input("enter your CNN's URL here")
|
107 |
+
|
108 |
if url:
|
109 |
result = categorize(url)
|
110 |
st.json(result)
|