Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -98,15 +98,8 @@ def chat():
|
|
| 98 |
text = ""
|
| 99 |
|
| 100 |
for item in content:
|
| 101 |
-
if item.get('type') == '
|
| 102 |
-
|
| 103 |
-
image = process_image(item['image_url']['url'])
|
| 104 |
-
elif 'image' in item:
|
| 105 |
-
image = process_image(item['image'])
|
| 106 |
-
else:
|
| 107 |
-
return jsonify({
|
| 108 |
-
"error": "Image content must have 'image_url' or 'image' field"
|
| 109 |
-
}), 400
|
| 110 |
elif item.get('type') == 'text':
|
| 111 |
text = item.get('text', '')
|
| 112 |
|
|
@@ -198,8 +191,5 @@ def upload_image():
|
|
| 198 |
}), 500
|
| 199 |
|
| 200 |
if __name__ == '__main__':
|
| 201 |
-
# Load model on startup
|
| 202 |
load_model()
|
| 203 |
-
|
| 204 |
-
# Run the Flask app on port 7860 for Hugging Face Spaces
|
| 205 |
app.run(host='0.0.0.0', port=7860, debug=False)
|
|
|
|
| 98 |
text = ""
|
| 99 |
|
| 100 |
for item in content:
|
| 101 |
+
if item.get('type') == 'image_url' and 'image_url' in item and 'url' in item['image_url']:
|
| 102 |
+
image = process_image(item['image_url']['url'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
elif item.get('type') == 'text':
|
| 104 |
text = item.get('text', '')
|
| 105 |
|
|
|
|
| 191 |
}), 500
|
| 192 |
|
| 193 |
if __name__ == '__main__':
|
|
|
|
| 194 |
load_model()
|
|
|
|
|
|
|
| 195 |
app.run(host='0.0.0.0', port=7860, debug=False)
|