Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,9 +21,11 @@ def classify_text(model, text):
|
|
| 21 |
|
| 22 |
|
| 23 |
def classify_text_azure(model, text):
|
| 24 |
-
#
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
| 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
|