Update app/dip.py
Browse files- 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 |
-
#
|
| 27 |
-
|
| 28 |
-
response = ollama.chat(model=OLLAMA_MODEL_NAME, messages=[{"role": "user", "content":
|
|
|
|
|
|
|
|
|
|
| 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)
|