Spaces:
Sleeping
Sleeping
Trying to call the hugging face inference API in the tool
Browse files
app.py
CHANGED
|
@@ -104,7 +104,17 @@ def newsworthiness_detection(fetch_message_from_newsweb: str) -> str:
|
|
| 104 |
- MEDIUM: [begrunnelse]
|
| 105 |
- LAV: [begrunnelse]
|
| 106 |
"""
|
| 107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
|
| 109 |
|
| 110 |
@tool
|
|
|
|
| 104 |
- MEDIUM: [begrunnelse]
|
| 105 |
- LAV: [begrunnelse]
|
| 106 |
"""
|
| 107 |
+
try:
|
| 108 |
+
response = hf_client.text_generation(
|
| 109 |
+
prompt=full_prompt,
|
| 110 |
+
max_new_tokens=150,
|
| 111 |
+
temperature=0.2,
|
| 112 |
+
return_full_text=False
|
| 113 |
+
)
|
| 114 |
+
return response.strip()
|
| 115 |
+
|
| 116 |
+
except Exception as e:
|
| 117 |
+
return f"Error: {str(e)}"
|
| 118 |
|
| 119 |
|
| 120 |
@tool
|