Spaces:
Build error
Build error
again changing the call of the preprocessing step
Browse files
app.py
CHANGED
|
@@ -102,16 +102,19 @@ async def predict(predictionFeatures: PredictionFeatures):
|
|
| 102 |
"""
|
| 103 |
|
| 104 |
# First preprocess the text directly
|
| 105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
|
| 107 |
-
|
|
|
|
|
|
|
| 108 |
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
print(preprocessed_result)
|
| 113 |
-
print([preprocessed_result['text_clean']['0']])
|
| 114 |
-
list_text = [preprocessed_result['text_clean']['0']]
|
| 115 |
|
| 116 |
# Load model from MLflow
|
| 117 |
logged_model = 'runs:/227d2f8e431d40d6b5231add3a00d048/hate_speech_detection'
|
|
|
|
| 102 |
"""
|
| 103 |
|
| 104 |
# First preprocess the text directly
|
| 105 |
+
url = "https://llepogam-hate-speech-detection-api.hf.space/preprocess"
|
| 106 |
+
headers = {
|
| 107 |
+
"accept": "application/json",
|
| 108 |
+
"Content-Type": "application/json"
|
| 109 |
+
}
|
| 110 |
|
| 111 |
+
data = {
|
| 112 |
+
"tweet": predictionFeatures.Text
|
| 113 |
+
}
|
| 114 |
|
| 115 |
+
response = requests.post(url, headers=headers, json=data)
|
| 116 |
+
|
| 117 |
+
list_text = [response.json()['text_clean']['0']]
|
|
|
|
|
|
|
|
|
|
| 118 |
|
| 119 |
# Load model from MLflow
|
| 120 |
logged_model = 'runs:/227d2f8e431d40d6b5231add3a00d048/hate_speech_detection'
|