Spaces:
Running
Running
Add logs
Browse files
app.py
CHANGED
|
@@ -70,6 +70,8 @@ def get_robot_txt():
|
|
| 70 |
def predict(model: InputModel) -> OutputModel:
|
| 71 |
text = model.query.message.text
|
| 72 |
|
|
|
|
|
|
|
| 73 |
urls = extract_urls(text)
|
| 74 |
results = [urlscan.scan(url) for url in urls]
|
| 75 |
|
|
@@ -83,9 +85,11 @@ def predict(model: InputModel) -> OutputModel:
|
|
| 83 |
|
| 84 |
label = pipe(text)
|
| 85 |
if label[0]['label'] == 'LABEL_1':
|
|
|
|
| 86 |
submit_entry(model.query.sender, model.query.message.text)
|
| 87 |
return OutputModel(action=ActionModel.JUNK, sub_action=SubActionModel.NONE)
|
| 88 |
else:
|
|
|
|
| 89 |
return OutputModel(action=ActionModel.NONE, sub_action=SubActionModel.NONE)
|
| 90 |
|
| 91 |
class ReportModel(BaseModel):
|
|
|
|
| 70 |
def predict(model: InputModel) -> OutputModel:
|
| 71 |
text = model.query.message.text
|
| 72 |
|
| 73 |
+
print(f"Predict: {text}")
|
| 74 |
+
|
| 75 |
urls = extract_urls(text)
|
| 76 |
results = [urlscan.scan(url) for url in urls]
|
| 77 |
|
|
|
|
| 85 |
|
| 86 |
label = pipe(text)
|
| 87 |
if label[0]['label'] == 'LABEL_1':
|
| 88 |
+
print("Classify LABEL_1. Submitting entry and returning JUNK.")
|
| 89 |
submit_entry(model.query.sender, model.query.message.text)
|
| 90 |
return OutputModel(action=ActionModel.JUNK, sub_action=SubActionModel.NONE)
|
| 91 |
else:
|
| 92 |
+
print("Classify LABEL_0. Submitting entry and returning NONE.")
|
| 93 |
return OutputModel(action=ActionModel.NONE, sub_action=SubActionModel.NONE)
|
| 94 |
|
| 95 |
class ReportModel(BaseModel):
|