Spaces:
Sleeping
Sleeping
Update helpers/llm_helper.py
Browse files- helpers/llm_helper.py +9 -6
helpers/llm_helper.py
CHANGED
|
@@ -8,13 +8,16 @@ def analyze_image_file(image_file, model, user_prompt):
|
|
| 8 |
# gets image bytes using helper function
|
| 9 |
image_bytes = get_image_bytes(image_file)
|
| 10 |
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
| 16 |
|
| 17 |
-
|
|
|
|
| 18 |
|
| 19 |
# handles stream response back from LLM
|
| 20 |
def stream_parser(stream):
|
|
|
|
| 8 |
# gets image bytes using helper function
|
| 9 |
image_bytes = get_image_bytes(image_file)
|
| 10 |
|
| 11 |
+
# API call to remote Ollama server (update with actual URL)
|
| 12 |
+
url = 'https://502f-2401-4900-882d-894-a2-f66f-ba2b-969f.ngrok-free.app'
|
| 13 |
+
data = {
|
| 14 |
+
'model': model,
|
| 15 |
+
'prompt': user_prompt,
|
| 16 |
+
'image_bytes': image_bytes
|
| 17 |
+
}
|
| 18 |
|
| 19 |
+
response = requests.post(url, json=data)
|
| 20 |
+
return response.json()
|
| 21 |
|
| 22 |
# handles stream response back from LLM
|
| 23 |
def stream_parser(stream):
|