|
import streamlit as st |
|
from streamlit_option_menu import option_menu |
|
from transformers import pipeline, Conversation |
|
|
|
convo = pipeline(task="conversational", model="microsoft/DialoGPT-medium") |
|
imgclassifier = pipeline(model="microsoft/beit-base-patch16-224-pt22k-ft22k") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def chat(): |
|
if query := st.chat_input("Enter your message"): |
|
uquery = Conversation(query) |
|
response = convo(uquery) |
|
with st.chat_message("assistant"): |
|
st.write(response.generated_responses[-1]) |
|
|
|
|
|
def image_classifi(): |
|
with st.sidebar: |
|
file = st.file_uploader("Upload Image", ["png", "jpg"]) |
|
output = imgclassifier(file) |
|
if st.button("View Results"): |
|
st.write(output) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def dashboard(): |
|
|
|
with st.sidebar: |
|
selected = option_menu(None, ['Conversational', "Q&A", "Text Generation", "Text Classification", "Image Classification", "Summurization", "Visual Q&A" , "Logout"], |
|
icons=['π¬','β', 'π', 'π€', 'πΌοΈ', 'π', 'π', 'π']) |
|
|
|
|
|
if selected == 'Conversational': |
|
chat() |
|
<<<<<<< HEAD |
|
elif selected == "Image Classification": |
|
image_classifi() |
|
======= |
|
>>>>>>> 1380c5c1abf8f579060f784d6ae0224298981b96 |
|
elif selected == 'Logout': |
|
st.session_state.user = None |
|
st.experimental_rerun() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|