llepogam commited on
Commit
06a6509
·
1 Parent(s): 22ee632

again changing the call of the preprocessing step

Browse files
Files changed (1) hide show
  1. app.py +11 -8
app.py CHANGED
@@ -102,16 +102,19 @@ async def predict(predictionFeatures: PredictionFeatures):
102
  """
103
 
104
  # First preprocess the text directly
105
- text_to_preprocess = PreprocessingFeatures(tweet=predictionFeatures.Text)
 
 
 
 
106
 
107
- print(text_to_preprocess)
 
 
108
 
109
- preprocessed_result = await preprocess_text(text_to_preprocess)
110
-
111
- # Use the preprocessed text for prediction
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'