Spaces:
Build error
Build error
Update app.py
Browse filesimage open and pil
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import gradio as gr
|
| 3 |
from gradio_client import Client
|
| 4 |
-
|
| 5 |
|
| 6 |
fuyu_client = Client("https://adept-fuyu-8b-demo.hf.space/")
|
| 7 |
def get_caption(image_in):
|
|
@@ -23,12 +23,12 @@ def get_caption(image_in):
|
|
| 23 |
|
| 24 |
return truncated_caption
|
| 25 |
|
| 26 |
-
|
| 27 |
|
| 28 |
# Display the uploaded image
|
| 29 |
-
if
|
| 30 |
# Read the image
|
| 31 |
-
|
| 32 |
|
| 33 |
# Display the image
|
| 34 |
st.image(image, caption="Uploaded Image", use_column_width=True)
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import gradio as gr
|
| 3 |
from gradio_client import Client
|
| 4 |
+
from PIL import Image
|
| 5 |
|
| 6 |
fuyu_client = Client("https://adept-fuyu-8b-demo.hf.space/")
|
| 7 |
def get_caption(image_in):
|
|
|
|
| 23 |
|
| 24 |
return truncated_caption
|
| 25 |
|
| 26 |
+
image_1 = st.file_uploader("Drag and drop an image here, or click to select one", type=["png", "jpg", "jpeg"])
|
| 27 |
|
| 28 |
# Display the uploaded image
|
| 29 |
+
if image_1 is not None:
|
| 30 |
# Read the image
|
| 31 |
+
image = Image.open(image_1)
|
| 32 |
|
| 33 |
# Display the image
|
| 34 |
st.image(image, caption="Uploaded Image", use_column_width=True)
|