Akash297 commited on
Commit
ed60ea9
·
verified ·
1 Parent(s): 4bc5ddc

Update app/dip.py

Browse files
Files changed (1) hide show
  1. app/dip.py +8 -5
app/dip.py CHANGED
@@ -22,10 +22,13 @@ def detect_depression():
22
 
23
  text = data['text']
24
  app.logger.info(f"Processing text: {text[:50]}...")
25
-
26
- # Generate response using Ollama model
27
- prompt = f"Analyze the following text for signs of depression and classify the severity as ZERO, MILD, INTERMEDIATE, or SEVERE: {text}"
28
- response = ollama.chat(model=OLLAMA_MODEL_NAME, messages=[{"role": "user", "content": prompt}])
 
 
 
29
 
30
  # Extract relevant information from the response
31
  result_text = response['message']['content'] if 'message' in response else "No response received"
@@ -41,4 +44,4 @@ def detect_depression():
41
  return jsonify({'error': str(e)}), 500
42
 
43
  if __name__ == '__main__':
44
- app.run(host='0.0.0.0', port=7860, debug=False)
 
22
 
23
  text = data['text']
24
  app.logger.info(f"Processing text: {text[:50]}...")
25
+
26
+ # Check if Ollama is responsive
27
+ app.logger.info("Calling Ollama model...")
28
+ response = ollama.chat(model=OLLAMA_MODEL_NAME, messages=[{"role": "user", "content": f"Analyze the following text for signs of depression: {text}"}])
29
+
30
+ # Log the full response for debugging
31
+ app.logger.info(f"Response from Ollama: {response}")
32
 
33
  # Extract relevant information from the response
34
  result_text = response['message']['content'] if 'message' in response else "No response received"
 
44
  return jsonify({'error': str(e)}), 500
45
 
46
  if __name__ == '__main__':
47
+ app.run(host='0.0.0.0', port=7860, debug=False)