CosmoAI commited on
Commit
b9b32f2
1 Parent(s): 1489c50

functionalities

Browse files
Files changed (1) hide show
  1. Home.py +44 -15
Home.py CHANGED
@@ -4,6 +4,11 @@ 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
 
8
 
9
  # def homepage():
@@ -19,6 +24,7 @@ imgclassifier = pipeline(model="microsoft/beit-base-patch16-224-pt22k-ft22k")
19
 
20
 
21
  def chat():
 
22
  if query := st.chat_input("Enter your message"):
23
  uquery = Conversation(query)
24
  response = convo(uquery)
@@ -27,29 +33,52 @@ def chat():
27
 
28
 
29
  def image_classifi():
30
- with st.sidebar:
31
- file = st.file_uploader("Upload Image", ["png", "jpg"])
32
  output = imgclassifier(file)
33
  if st.button("View Results"):
34
  st.write(output)
35
 
36
 
37
- # def invoke_audio():
38
- # st.write("Invoke Audio")
39
- # st.write("Welcome to the invoke audio page")
40
-
41
- # def invoke_video():
42
- # st.write("Invoke Video")
43
- # st.write("Welcome to the invoke video page")
44
 
45
- # def invoke_image():
46
- # st.write("Invoke Image")
47
- # st.write("Welcome to the invoke image page")
 
 
 
48
 
49
- # def invoke_text():
50
- # st.write("Invoke Text")
51
- # st.write("Welcome to the invoke text page")
 
 
 
52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
 
54
 
55
 
 
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
 
14
  # def homepage():
 
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)
 
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")
74
+ with st.sidebar:
75
+ if img := st.text_input("Enter Image URL"):
76
+ st.image(img)
77
+ if query := st.chat_input("Enter your message"):
78
+ response = visualqna(img, query)
79
+ with st.chat_message("assistant"):
80
+ st.write(response)
81
+
82
 
83
 
84