Update app.py
Browse files
app.py
CHANGED
|
@@ -173,9 +173,20 @@ def process_image(image_path, prompt):
|
|
| 173 |
|
| 174 |
# Prepare the data for the API request (specific to the API you're using)
|
| 175 |
data = {
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
return data
|
| 180 |
|
| 181 |
|
|
@@ -457,7 +468,7 @@ def generate_text (prompt, file, chatbot, history, rag_option, model_option, ope
|
|
| 457 |
history_text_und_prompt = generate_prompt_with_history_openai(prompt, history)
|
| 458 |
else:
|
| 459 |
prompt_neu = process_image(file, prompt)
|
| 460 |
-
history_text_und_prompt = generate_prompt_with_history_openai(prompt_neu, history)
|
| 461 |
print("historyundtextundfile.................")
|
| 462 |
print(history_text_und_prompt)
|
| 463 |
#history für HuggingFace Models formatieren
|
|
|
|
| 173 |
|
| 174 |
# Prepare the data for the API request (specific to the API you're using)
|
| 175 |
data = {
|
| 176 |
+
"role": "user",
|
| 177 |
+
"content": [
|
| 178 |
+
{
|
| 179 |
+
"type": "text",
|
| 180 |
+
"text": "What’s in this image?"
|
| 181 |
+
},
|
| 182 |
+
{
|
| 183 |
+
"type": "image_url",
|
| 184 |
+
"image_url": {
|
| 185 |
+
"url": f"data:image/jpeg;base64,{encoded_string}"
|
| 186 |
+
}
|
| 187 |
+
}
|
| 188 |
+
]
|
| 189 |
+
}
|
| 190 |
return data
|
| 191 |
|
| 192 |
|
|
|
|
| 468 |
history_text_und_prompt = generate_prompt_with_history_openai(prompt, history)
|
| 469 |
else:
|
| 470 |
prompt_neu = process_image(file, prompt)
|
| 471 |
+
history_text_und_prompt = prompt_neu #generate_prompt_with_history_openai(prompt_neu, history)
|
| 472 |
print("historyundtextundfile.................")
|
| 473 |
print(history_text_und_prompt)
|
| 474 |
#history für HuggingFace Models formatieren
|