NKessler commited on
Commit
7bec576
·
verified ·
1 Parent(s): 3e809a2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -65,8 +65,10 @@ def analyze_article(text: str) -> dict:
65
  "{safe_text}"
66
  """
67
 
68
- response = client.text_generation(prompt, max_new_tokens=250, temperature=0.1)
69
- llm_data = _extract_json_from_llm(response)
 
 
70
 
71
  subjectivity_score = TextBlob(safe_text).sentiment.subjectivity
72
  raw_reading_ease = textstat.flesch_reading_ease(safe_text)
@@ -213,8 +215,10 @@ def check_contradiction(text_a: str, text_b: str) -> dict:
213
  Text 1: "{text_a[:1000]}"
214
  Text 2: "{text_b[:1000]}"
215
  """
216
- response = client.text_generation(prompt, max_new_tokens=100, temperature=0.1)
217
- result = _extract_json_from_llm(response)
 
 
218
  return {"relationship": result.get("relationship", "NEUTRAL"), "confidence": result.get("confidence", 0.0)}
219
 
220
 
 
65
  "{safe_text}"
66
  """
67
 
68
+ messages = [{"role": "user", "content": prompt}]
69
+ response = client.chat_completion(messages=messages, max_tokens=250, temperature=0.1)
70
+ response_text = response.choices[0].message.content
71
+ llm_data = _extract_json_from_llm(response_text)
72
 
73
  subjectivity_score = TextBlob(safe_text).sentiment.subjectivity
74
  raw_reading_ease = textstat.flesch_reading_ease(safe_text)
 
215
  Text 1: "{text_a[:1000]}"
216
  Text 2: "{text_b[:1000]}"
217
  """
218
+ messages = [{"role": "user", "content": prompt}]
219
+ response = client.chat_completion(messages=messages, max_tokens=100, temperature=0.1)
220
+ response_text = response.choices[0].message.content
221
+ result = _extract_json_from_llm(response_text)
222
  return {"relationship": result.get("relationship", "NEUTRAL"), "confidence": result.get("confidence", 0.0)}
223
 
224