Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,12 +3,17 @@ from azure.ai.textanalytics import TextAnalyticsClient
|
|
| 3 |
from azure.core.credentials import AzureKeyCredential
|
| 4 |
|
| 5 |
# Azure Text Analytics setup
|
|
|
|
| 6 |
azure_endpoint = "https://t6langservice.cognitiveservices.azure.com/"
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
text_analytics_client = TextAnalyticsClient(endpoint=azure_endpoint, credential=AzureKeyCredential(azure_api_key))
|
| 9 |
|
|
|
|
| 10 |
def classify_text_azure(text):
|
| 11 |
-
|
| 12 |
try:
|
| 13 |
# Ensure input is in the correct format (list of strings)
|
| 14 |
documents = [text]
|
|
|
|
| 3 |
from azure.core.credentials import AzureKeyCredential
|
| 4 |
|
| 5 |
# Azure Text Analytics setup
|
| 6 |
+
# this is the end point for the Azure service I created
|
| 7 |
azure_endpoint = "https://t6langservice.cognitiveservices.azure.com/"
|
| 8 |
+
|
| 9 |
+
# this is the KEY for the Azure API Service I created. I did not use any class or data structure to store this key
|
| 10 |
+
azure_api_key = "3CU1gpUszvl7pLb90Ivdp1Kd5WZc56savzdXOK5GV40JHebnxnxoJQQJ99BAACYeBjFXJ3w3AAAaACOGkRT5"
|
| 11 |
+
|
| 12 |
+
# call to the Azure TextAnalyticsClient API
|
| 13 |
text_analytics_client = TextAnalyticsClient(endpoint=azure_endpoint, credential=AzureKeyCredential(azure_api_key))
|
| 14 |
|
| 15 |
+
# function which take sthe inut text from the user , then make a call to Azure text analytics service and returns the output in json format with key putput parameter
|
| 16 |
def classify_text_azure(text):
|
|
|
|
| 17 |
try:
|
| 18 |
# Ensure input is in the correct format (list of strings)
|
| 19 |
documents = [text]
|