CosmoAI commited on
Commit
6e15e69
β€’
1 Parent(s): b9b32f2

Update Home.py

Browse files
Files changed (1) hide show
  1. Home.py +47 -47
Home.py CHANGED
@@ -2,12 +2,12 @@ import streamlit as st
2
  from streamlit_option_menu import option_menu
3
  from transformers import pipeline, Conversation
4
 
5
- convo = pipeline(task="conversational", model="microsoft/DialoGPT-medium")
6
- imgclassifier = pipeline(model="microsoft/beit-base-patch16-224-pt22k-ft22k")
7
- qnabot = pipeline(task="question-answering", model="distilbert-base-cased-distilled-squad")
8
- txtgen = pipeline(task="text-generation", model="EleutherAI/gpt-neo-2.7B")
9
- txtclassifi = pipeline(task="text-classification", model="nlptown/bert-base-multilingual-uncased-sentiment")
10
- summurize = pipeline(task="summarization", model="sshleifer/distilbart-cnn-12-6")
11
  visualqna = pipeline(task="vqa", model="microsoft/DialoGPT-medium")
12
 
13
 
@@ -23,51 +23,51 @@ visualqna = pipeline(task="vqa", model="microsoft/DialoGPT-medium")
23
  # st.session_state.messages
24
 
25
 
26
- def chat():
27
- st.title("Chit-Chatbot")
28
- if query := st.chat_input("Enter your message"):
29
- uquery = Conversation(query)
30
- response = convo(uquery)
31
- with st.chat_message("assistant"):
32
- st.write(response.generated_responses[-1])
33
 
34
 
35
- def image_classifi():
36
- st.title("Image Classification")
37
- file = st.text_input("Enter Image URL")
38
- output = imgclassifier(file)
39
- if st.button("View Results"):
40
- st.write(output)
41
 
42
 
43
- def qna_bot():
44
- st.title("Q&A-Chatbot")
45
- if query := st.chat_input("Enter your message"):
46
- response = qnabot(query)
47
- with st.chat_message("assistant"):
48
- st.write(response)
49
 
50
 
51
- def txt_gen():
52
- st.title("Text Generation")
53
- if query := st.chat_input("Enter your message"):
54
- response = txtgen(query)
55
- with st.chat_message("assistant"):
56
- st.write(response)
57
 
58
- def txt_classifi():
59
- st.title("Text Classification")
60
- if query := st.chat_input("Enter your message"):
61
- response = txtclassifi(query,)
62
- with st.chat_message("assistant"):
63
- st.write(response)
64
 
65
- def summury():
66
- st.title("Summury")
67
- if query := st.chat_input("Enter your message"):
68
- response = summurize(query, min_length=5, max_length=20)
69
- with st.chat_message("assistant"):
70
- st.write(response)
71
 
72
  def visual_qna():
73
  st.title("Visual Q&A")
@@ -89,10 +89,10 @@ def dashboard():
89
  icons=['πŸ’¬','❓', 'πŸ“', 'πŸ”€', 'πŸ–ΌοΈ', 'πŸ“‘', 'πŸ”Ž', 'πŸ”“'])
90
  # if selected == 'Home':
91
  # homepage()
92
- if selected == 'Conversational':
93
- chat()
94
- elif selected == "Image Classification":
95
- image_classifi()
96
  elif selected == 'Logout':
97
  st.session_state.user = None
98
  st.experimental_rerun()
 
2
  from streamlit_option_menu import option_menu
3
  from transformers import pipeline, Conversation
4
 
5
+ # convo = pipeline(task="conversational", model="microsoft/DialoGPT-medium")
6
+ # imgclassifier = pipeline(model="microsoft/beit-base-patch16-224-pt22k-ft22k")
7
+ # qnabot = pipeline(task="question-answering", model="distilbert-base-cased-distilled-squad")
8
+ # txtgen = pipeline(task="text-generation", model="EleutherAI/gpt-neo-2.7B")
9
+ # txtclassifi = pipeline(task="text-classification", model="nlptown/bert-base-multilingual-uncased-sentiment")
10
+ # summurize = pipeline(task="summarization", model="sshleifer/distilbart-cnn-12-6")
11
  visualqna = pipeline(task="vqa", model="microsoft/DialoGPT-medium")
12
 
13
 
 
23
  # st.session_state.messages
24
 
25
 
26
+ # def chat():
27
+ # st.title("Chit-Chatbot")
28
+ # if query := st.chat_input("Enter your message"):
29
+ # uquery = Conversation(query)
30
+ # response = convo(uquery)
31
+ # with st.chat_message("assistant"):
32
+ # st.write(response.generated_responses[-1])
33
 
34
 
35
+ # def image_classifi():
36
+ # st.title("Image Classification")
37
+ # file = st.text_input("Enter Image URL")
38
+ # output = imgclassifier(file)
39
+ # if st.button("View Results"):
40
+ # st.write(output)
41
 
42
 
43
+ # def qna_bot():
44
+ # st.title("Q&A-Chatbot")
45
+ # if query := st.chat_input("Enter your message"):
46
+ # response = qnabot(query)
47
+ # with st.chat_message("assistant"):
48
+ # st.write(response)
49
 
50
 
51
+ # def txt_gen():
52
+ # st.title("Text Generation")
53
+ # if query := st.chat_input("Enter your message"):
54
+ # response = txtgen(query)
55
+ # with st.chat_message("assistant"):
56
+ # st.write(response)
57
 
58
+ # def txt_classifi():
59
+ # st.title("Text Classification")
60
+ # if query := st.chat_input("Enter your message"):
61
+ # response = txtclassifi(query,)
62
+ # with st.chat_message("assistant"):
63
+ # st.write(response)
64
 
65
+ # def summury():
66
+ # st.title("Summury")
67
+ # if query := st.chat_input("Enter your message"):
68
+ # response = summurize(query, min_length=5, max_length=20)
69
+ # with st.chat_message("assistant"):
70
+ # st.write(response)
71
 
72
  def visual_qna():
73
  st.title("Visual Q&A")
 
89
  icons=['πŸ’¬','❓', 'πŸ“', 'πŸ”€', 'πŸ–ΌοΈ', 'πŸ“‘', 'πŸ”Ž', 'πŸ”“'])
90
  # if selected == 'Home':
91
  # homepage()
92
+ if selected == 'Visual Q&A':
93
+ visual_qna()
94
+ # elif selected == "Image Classification":
95
+ # image_classifi()
96
  elif selected == 'Logout':
97
  st.session_state.user = None
98
  st.experimental_rerun()