Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -30,11 +30,14 @@ def generate(message, history, model, system_prompt,
|
|
30 |
history_openai_format = [{"role": "system", "content": system_prompt}]
|
31 |
for user, assistant in history:
|
32 |
if isinstance(user, tuple): # there were files
|
|
|
|
|
|
|
33 |
content = [
|
34 |
{"type": "image_url",
|
35 |
# for some reason you don't get the same image format in history as in message
|
36 |
"image_url": {"url": process_image({'path': filepath,
|
37 |
-
'mime_type':
|
38 |
for filepath in user]
|
39 |
|
40 |
history_openai_format.append(
|
|
|
30 |
history_openai_format = [{"role": "system", "content": system_prompt}]
|
31 |
for user, assistant in history:
|
32 |
if isinstance(user, tuple): # there were files
|
33 |
+
mime_type = get_mimetype(filepath)
|
34 |
+
if not mime_type.contains('image'):
|
35 |
+
raise gradio.Error("Momenteel zijn alleen afbeeldingen ondersteund als bijlagen 💥!", duration=5)
|
36 |
content = [
|
37 |
{"type": "image_url",
|
38 |
# for some reason you don't get the same image format in history as in message
|
39 |
"image_url": {"url": process_image({'path': filepath,
|
40 |
+
'mime_type': mime_type})}}
|
41 |
for filepath in user]
|
42 |
|
43 |
history_openai_format.append(
|