musaashaikh commited on
Commit
7aa11f0
·
verified ·
1 Parent(s): 09cec08

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -21,9 +21,11 @@ def classify_text(model, text):
21
 
22
 
23
  def classify_text_azure(model, text):
24
- # Use the loaded model to classify text
25
- result = text_analytics_client.analyze_sentiment(text)
26
- return result
 
 
27
 
28
  def main():
29
  # Load the model
 
21
 
22
 
23
  def classify_text_azure(model, text):
24
+ # Ensure input is in the correct format (list of strings)
25
+ documents = [text] # Wrap the input string in a list
26
+ result = text_analytics_client.analyze_sentiment(documents=documents)
27
+ return [{"id": i, "sentiment": doc.sentiment, "confidence_scores": doc.confidence_scores} for i, doc in enumerate(result)]
28
+
29
 
30
  def main():
31
  # Load the model