Spaces:
Runtime error
Runtime error
File size: 743 Bytes
1dc4501 4eb173a fea62a9 4eb173a fea62a9 4eb173a fea62a9 4eb173a fea62a9 4eb173a fea62a9 4eb173a fea62a9 4eb173a 985be42 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import streamlit as st
import pandas as pd
from io import StringIO
from PIL import Image
import graphviz as gv
uploaded_files = st.file_uploader("Choose an image file", accept_multiple_files=True, type=["jpg", "jpeg", "png"])
images = []
for uploaded_file in uploaded_files:
# To read file as bytes:
bytes_data = uploaded_file.getvalue()
# To convert to a PIL image:
image = Image.open(uploaded_file)
images.append(image)
# Create the Graphviz model using the uploaded images
dot = gv.Digraph()
for i, image in enumerate(images):
dot.node(str(i), image=image)
for i in range(len(images) - 1):
dot.edge(str(i), str(i+1))
# Render the Graphviz model using the Streamlit framework
st.graphviz_chart(dot.source)
|