File size: 1,620 Bytes
4c741a4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import streamlit as st
import os
# Title
st.title("Vietnamese Multimodel NER")
def save_uploaded_image(image, directory):
    if not os.path.exists(directory):
        os.makedirs(directory)
    file_path = os.path.join(directory, image.name)
    with open(file_path, "wb") as f:
        f.write(image.getbuffer())
    return file_path

# Sidebar for selection
st.sidebar.title('Selection')
page = st.sidebar.selectbox("Choose a page", ["NER", "Multimodal NER"])

# NER page
if page == "NER":
    st.header("NER")
    text = st.text_area("Enter your text for NER:", height=300)
    if st.button("Process NER"):
        st.write("Processing text with NER model...")
        # Add your NER processing code here
        st.write(f"Input text: {text}")

# Multimodal NER page
elif page == "Multimodal NER":
    st.header("Multimodal NER")
    text = st.text_area("Enter your text for Multimodal NER:", height=300)
    image = st.file_uploader("Upload an image:", type=["png", "jpg", "jpeg"])
    if st.button("Process Multimodal NER"):
        st.write("Processing text and image with Multimodal NER model...")
        # Add your Multimodal NER processing code here
        st.write(f"Input text: {text}")
        if image:
            save_path='E:/demo_datn/pythonProject1/Model/MultimodelNER/VLSP2016/Image'
            image_name = image.name
            print(image_name)
            saved_image_path = save_uploaded_image(image, save_path)

            st.image(image, caption="Uploaded Image", use_column_width=True)
        else:
            st.write("No image uploaded.")