fosse commited on
Commit
fc51588
·
verified ·
1 Parent(s): 78dd545

Trying to call the hugging face inference API in the tool

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -104,7 +104,17 @@ def newsworthiness_detection(fetch_message_from_newsweb: str) -> str:
104
  - MEDIUM: [begrunnelse]
105
  - LAV: [begrunnelse]
106
  """
107
- return(full_prompt)
 
 
 
 
 
 
 
 
 
 
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