Spaces:
Paused
Paused
| 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.") | |