Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ from PIL import Image
|
|
3 |
import inference
|
4 |
from transformers import AutoProcessor, AutoModelForCausalLM
|
5 |
from PIL import Image
|
|
|
6 |
import requests
|
7 |
import copy
|
8 |
import os
|
@@ -62,8 +63,10 @@ uploaded_image = st.sidebar.file_uploader("Upload your image here", type=["jpg",
|
|
62 |
# Display the uploaded image and process it if available
|
63 |
if uploaded_image is not None:
|
64 |
image = Image.open(uploaded_image)
|
65 |
-
|
|
|
66 |
st.image(image, caption="Uploaded Image", use_column_width=True)
|
|
|
67 |
# Task prompt input
|
68 |
task_prompt = st.sidebar.text_input("Task Prompt", value="Describe the image in detail:")
|
69 |
# Additional text input (optional)
|
|
|
3 |
import inference
|
4 |
from transformers import AutoProcessor, AutoModelForCausalLM
|
5 |
from PIL import Image
|
6 |
+
import io
|
7 |
import requests
|
8 |
import copy
|
9 |
import os
|
|
|
63 |
# Display the uploaded image and process it if available
|
64 |
if uploaded_image is not None:
|
65 |
image = Image.open(uploaded_image)
|
66 |
+
image_bytes = io.BytesIO()
|
67 |
+
image.save(image_bytes, format=image.format)
|
68 |
st.image(image, caption="Uploaded Image", use_column_width=True)
|
69 |
+
image_binary = image_bytes.getvalue()
|
70 |
# Task prompt input
|
71 |
task_prompt = st.sidebar.text_input("Task Prompt", value="Describe the image in detail:")
|
72 |
# Additional text input (optional)
|