Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -44,11 +44,17 @@ def get_humanized_text(text, token):
|
|
| 44 |
|
| 45 |
try:
|
| 46 |
response = requests.post(API_URL, headers=headers, json={"inputs": text})
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
return response.json()[0]["generated_text"]
|
| 49 |
except Exception as e:
|
| 50 |
print(f"Error calling Hugging Face API: {e}")
|
| 51 |
-
return "Error processing text with Hugging Face API
|
| 52 |
|
| 53 |
# Load NLP models
|
| 54 |
try:
|
|
|
|
| 44 |
|
| 45 |
try:
|
| 46 |
response = requests.post(API_URL, headers=headers, json={"inputs": text})
|
| 47 |
+
|
| 48 |
+
# Print more detailed error info
|
| 49 |
+
if response.status_code != 200:
|
| 50 |
+
print(f"Hugging Face API error: {response.status_code}")
|
| 51 |
+
print(f"Response content: {response.text}")
|
| 52 |
+
|
| 53 |
+
response.raise_for_status()
|
| 54 |
return response.json()[0]["generated_text"]
|
| 55 |
except Exception as e:
|
| 56 |
print(f"Error calling Hugging Face API: {e}")
|
| 57 |
+
return f"Error processing text with Hugging Face API: {str(e)}"
|
| 58 |
|
| 59 |
# Load NLP models
|
| 60 |
try:
|