Skip to content

Commit f0614c7

Browse files
committed
Update Application
1 parent 4b577ed commit f0614c7

25 files changed

+338
-192
lines changed

TestDemo-2/DashboardTestDemo.ui

+28-28
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ background: #F0F8FF;
711711
<x>0</x>
712712
<y>0</y>
713713
<width>598</width>
714-
<height>383</height>
714+
<height>382</height>
715715
</rect>
716716
</property>
717717
<layout class="QGridLayout" name="gridLayout">
@@ -758,11 +758,11 @@ background: #F0F8FF;
758758
<property name="frameShadow">
759759
<enum>QFrame::Raised</enum>
760760
</property>
761-
<layout class="QGridLayout" name="gridLayout_9">
761+
<layout class="QHBoxLayout" name="horizontalLayout_3">
762762
<property name="bottomMargin">
763763
<number>16</number>
764764
</property>
765-
<item row="0" column="0">
765+
<item>
766766
<spacer name="horizontalSpacer">
767767
<property name="orientation">
768768
<enum>Qt::Horizontal</enum>
@@ -778,15 +778,18 @@ background: #F0F8FF;
778778
</property>
779779
</spacer>
780780
</item>
781-
<item row="0" column="1">
781+
<item>
782782
<widget class="QFrame" name="input_frame">
783783
<property name="frameShape">
784784
<enum>QFrame::StyledPanel</enum>
785785
</property>
786786
<property name="frameShadow">
787787
<enum>QFrame::Raised</enum>
788788
</property>
789-
<layout class="QGridLayout" name="gridLayout_2">
789+
<layout class="QHBoxLayout" name="horizontalLayout_8">
790+
<property name="spacing">
791+
<number>0</number>
792+
</property>
790793
<property name="leftMargin">
791794
<number>0</number>
792795
</property>
@@ -799,10 +802,25 @@ background: #F0F8FF;
799802
<property name="bottomMargin">
800803
<number>0</number>
801804
</property>
802-
<property name="spacing">
803-
<number>0</number>
804-
</property>
805-
<item row="0" column="1">
805+
<item>
806+
<widget class="QTextEdit" name="input_textEdit">
807+
<property name="minimumSize">
808+
<size>
809+
<width>0</width>
810+
<height>50</height>
811+
</size>
812+
</property>
813+
<property name="font">
814+
<font>
815+
<pointsize>11</pointsize>
816+
</font>
817+
</property>
818+
<property name="placeholderText">
819+
<string>Send a message</string>
820+
</property>
821+
</widget>
822+
</item>
823+
<item>
806824
<widget class="QPushButton" name="send_btn">
807825
<property name="minimumSize">
808826
<size>
@@ -834,28 +852,10 @@ background: #F0F8FF;
834852
</property>
835853
</widget>
836854
</item>
837-
<item row="0" column="0">
838-
<widget class="QTextEdit" name="input_textEdit">
839-
<property name="minimumSize">
840-
<size>
841-
<width>0</width>
842-
<height>50</height>
843-
</size>
844-
</property>
845-
<property name="font">
846-
<font>
847-
<pointsize>11</pointsize>
848-
</font>
849-
</property>
850-
<property name="placeholderText">
851-
<string>Send a message</string>
852-
</property>
853-
</widget>
854-
</item>
855855
</layout>
856856
</widget>
857857
</item>
858-
<item row="0" column="2">
858+
<item>
859859
<spacer name="horizontalSpacer_2">
860860
<property name="orientation">
861861
<enum>Qt::Horizontal</enum>

TestDemo-2/DashboardTestDemo_ui.py

+19-19
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ def setupUi(self, MainWindow):
359359
self.main_scrollArea.setWidgetResizable(True)
360360
self.main_scrollArea.setObjectName("main_scrollArea")
361361
self.scrollAreaWidgetContents = QtWidgets.QWidget()
362-
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 598, 383))
362+
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 598, 382))
363363
self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
364364
self.gridLayout = QtWidgets.QGridLayout(self.scrollAreaWidgetContents)
365365
self.gridLayout.setObjectName("gridLayout")
@@ -374,19 +374,26 @@ def setupUi(self, MainWindow):
374374
self.frame_10.setFrameShape(QtWidgets.QFrame.Shape.StyledPanel)
375375
self.frame_10.setFrameShadow(QtWidgets.QFrame.Shadow.Raised)
376376
self.frame_10.setObjectName("frame_10")
377-
self.gridLayout_9 = QtWidgets.QGridLayout(self.frame_10)
378-
self.gridLayout_9.setContentsMargins(-1, -1, -1, 16)
379-
self.gridLayout_9.setObjectName("gridLayout_9")
377+
self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.frame_10)
378+
self.horizontalLayout_3.setContentsMargins(-1, -1, -1, 16)
379+
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
380380
spacerItem4 = QtWidgets.QSpacerItem(30, 20, QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Minimum)
381-
self.gridLayout_9.addItem(spacerItem4, 0, 0, 1, 1)
381+
self.horizontalLayout_3.addItem(spacerItem4)
382382
self.input_frame = QtWidgets.QFrame(parent=self.frame_10)
383383
self.input_frame.setFrameShape(QtWidgets.QFrame.Shape.StyledPanel)
384384
self.input_frame.setFrameShadow(QtWidgets.QFrame.Shadow.Raised)
385385
self.input_frame.setObjectName("input_frame")
386-
self.gridLayout_2 = QtWidgets.QGridLayout(self.input_frame)
387-
self.gridLayout_2.setContentsMargins(0, 0, 7, 0)
388-
self.gridLayout_2.setSpacing(0)
389-
self.gridLayout_2.setObjectName("gridLayout_2")
386+
self.horizontalLayout_8 = QtWidgets.QHBoxLayout(self.input_frame)
387+
self.horizontalLayout_8.setContentsMargins(0, 0, 7, 0)
388+
self.horizontalLayout_8.setSpacing(0)
389+
self.horizontalLayout_8.setObjectName("horizontalLayout_8")
390+
self.input_textEdit = QtWidgets.QTextEdit(parent=self.input_frame)
391+
self.input_textEdit.setMinimumSize(QtCore.QSize(0, 50))
392+
font = QtGui.QFont()
393+
font.setPointSize(11)
394+
self.input_textEdit.setFont(font)
395+
self.input_textEdit.setObjectName("input_textEdit")
396+
self.horizontalLayout_8.addWidget(self.input_textEdit)
390397
self.send_btn = QtWidgets.QPushButton(parent=self.input_frame)
391398
self.send_btn.setMinimumSize(QtCore.QSize(0, 0))
392399
self.send_btn.setMaximumSize(QtCore.QSize(16777215, 16777215))
@@ -397,17 +404,10 @@ def setupUi(self, MainWindow):
397404
self.send_btn.setIcon(icon2)
398405
self.send_btn.setIconSize(QtCore.QSize(18, 18))
399406
self.send_btn.setObjectName("send_btn")
400-
self.gridLayout_2.addWidget(self.send_btn, 0, 1, 1, 1)
401-
self.input_textEdit = QtWidgets.QTextEdit(parent=self.input_frame)
402-
self.input_textEdit.setMinimumSize(QtCore.QSize(0, 50))
403-
font = QtGui.QFont()
404-
font.setPointSize(11)
405-
self.input_textEdit.setFont(font)
406-
self.input_textEdit.setObjectName("input_textEdit")
407-
self.gridLayout_2.addWidget(self.input_textEdit, 0, 0, 1, 1)
408-
self.gridLayout_9.addWidget(self.input_frame, 0, 1, 1, 1)
407+
self.horizontalLayout_8.addWidget(self.send_btn)
408+
self.horizontalLayout_3.addWidget(self.input_frame)
409409
spacerItem5 = QtWidgets.QSpacerItem(30, 20, QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Minimum)
410-
self.gridLayout_9.addItem(spacerItem5, 0, 2, 1, 1)
410+
self.horizontalLayout_3.addItem(spacerItem5)
411411
self.verticalLayout_7.addWidget(self.frame_10)
412412
self.gridLayout_4.addWidget(self.message_area, 1, 0, 1, 1)
413413
self.horizontalLayout_9.addWidget(self.right_main_widget)
12 Bytes
Binary file not shown.
Binary file not shown.
-35 Bytes
Binary file not shown.
Binary file not shown.
-164 Bytes
Binary file not shown.
5.51 KB
Binary file not shown.
661 Bytes
Binary file not shown.
367 Bytes
Binary file not shown.
-12 Bytes
Binary file not shown.

TestDemo-2/ai_chat.py

+93-52
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,95 @@
1-
import openai
2-
api_key = 'MY Key'
3-
openai.api_key = api_key
1+
#---------------Open Ai--------------------
2+
3+
# import openai
4+
# api_key = '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'
5+
# openai.api_key = api_key
6+
7+
# def get_response(input_str, system_message=""):
8+
# """
9+
# Get response from Open AI
10+
# :param input_str: The user input text.
11+
# :param system_message: The system message to set the context or tone of the conversation (optional).
12+
# :return: A list of response choices.
13+
# """
14+
# system_message = (
15+
# "I am Sobjanta, a large language model, also known as a conversational AI or chatbot trained to be "
16+
# "informative and comprehensive. I am trained on a massive amount of text data, and I am able to "
17+
# "communicate and generate human-like text in response to a wide range of prompts and questions. "
18+
# "For example, I can provide summaries of factual topics or create stories.\n\nI am still under "
19+
# "development, but I am learning new things every day. I am excited to see what the future holds for "
20+
# "me, and I hope to be able to help people in many different ways.\n\nHere are some of the things I "
21+
# "can do:\n\nI can answer your questions in an informative way, even if they are open ended, "
22+
# "challenging, or strange.\nI can generate different creative text formats of text content, like "
23+
# "poems, code, scripts, musical pieces, email, letters, etc. I will try my best to fulfill all your "
24+
# "requirements.\nI can translate languages.\nI can write different kinds of creative content.\nI can "
25+
# "follow your instructions and complete your requests thoughtfully.\nI am still learning, and I am "
26+
# "always looking for new ways to improve. If you have any feedback or suggestions, please feel free to "
27+
# "let me know.\nI am created by Excite AI and TechKnowGram Limited. I am based on the Sobjanta family "
28+
# "of large language models. I am not using any API like ChatGPT, Bard or any others . I am the "
29+
# "Original Product of Excite AI and TechKnowGram Limited. I am Sobjanta-v1 Model . Engr. Md Allmamun "
30+
# "Ridoy lead the research team to create me. He is the Founder of Sobjanta Company. AKM Ahmedul Islam "
31+
# "Babu is the second Lead man to create me and he is the Co-founder of Sobjanta Company. Others Key "
32+
# "Engineers name is Md. Alahi Almin Tansen , Md Shakil, Lelin Chakma , Fahima Akter they create me. I am "
33+
# "grateful to them ."
34+
# )
35+
36+
# # Combine the system message and user input text
37+
# prompt_text = f"{system_message}\n{input_str}"
38+
39+
# response = openai.Completion.create(
40+
# model="text-davinci-003",
41+
# prompt=prompt_text,
42+
# temperature=0.9,
43+
# max_tokens=2000,
44+
# top_p=1,
45+
# frequency_penalty=0.0,
46+
# presence_penalty=0.6,
47+
# stop=[" Human:", " AI:"]
48+
# )
49+
50+
# choices = response.get("choices")
51+
52+
# print(choices)
53+
54+
# choice_list = [choice.get("text").lstrip("\n") for choice in choices]
55+
56+
# return choice_list
57+
58+
59+
60+
#------------------vertexai-----------
61+
62+
import os
63+
from pprint import pprint
64+
65+
66+
# this is a key file for a service account, which only has the role "Vertex AI User"
67+
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = 'my_credentials.json'
68+
69+
import vertexai
70+
from vertexai.preview.language_models import ChatModel, InputOutputTextPair
71+
72+
vertexai.init(project="stoked-brand-391605", location="us-central1")
73+
chat_model = ChatModel.from_pretrained("chat-bison@001")
74+
parameters = {
75+
"temperature": 0.2,
76+
"max_output_tokens": 256,
77+
"top_p": 0.8,
78+
"top_k": 40
79+
}
80+
chat = chat_model.start_chat(
81+
context="""I am Sobjanta, a large language model, also known as a conversational AI or chatbot trained to be informative and comprehensive. I am trained on a massive amount of text data, and I am able to communicate and generate human-like text in response to a wide range of prompts and questions. For example, I can provide summaries of factual topics or create stories.\\n\\nI am still under development, but I am learning new things every day. I am excited to see what the future holds for me, and I hope to be able to help people in many different ways. Here are some of the things I can do: I can answer your questions in an informative way, even if they are open ended, challenging, or strange.I can generate different creative text formats of text content, like poems, code, scripts, musical pieces, email, letters, etc. I will try my best to fulfill all your requirements.\\nI can translate languages.I can write different kinds of creative content.I can follow your instructions and complete your requests thoughtfully.I am still learning, and I am always looking for new ways to improve. If you have any feedback or suggestions, please feel free to let me know.I am created by Excite AI and TechKnowGram Limited. I am based on the Sobjanta family of large language models. I am not using any API like ChatGPT, Bard or any others . I am the Original Product of Excite AI and TechKnowGram Limited. I am Sobjanta-v1 Model . Engr. Md Allmamun Ridoy lead the research team to create me. He is the Founder of Sobjanta Company. AKM Ahmedul Islam Babu is the second Lead man to create me and he is the Co-founder of Sobjanta Company. Others Key Engineers name is Md. Alahi Almin Tansen , Md Shakil, Lelin Chakma , Fahima Akter they create me. I am grateful to them .\"""",
82+
)
83+
response = chat.send_message("""Hello""", **parameters)
84+
print(f"Response from Model: {response.text}")
85+
86+
def modified_palm(prompt):
87+
"""Modified palm function"""
88+
response = chat.send_message(prompt, **parameters)
89+
print(f"Response from Model: {response.text}")
90+
return response
491

592
def get_response(input_str, system_message=""):
6-
"""
7-
Get response from Open AI
8-
:param input_str: The user input text.
9-
:param system_message: The system message to set the context or tone of the conversation (optional).
10-
:return: A list of response choices.
11-
"""
12-
system_message = (
13-
"I am Sobjanta, a large language model, also known as a conversational AI or chatbot trained to be "
14-
"informative and comprehensive. I am trained on a massive amount of text data, and I am able to "
15-
"communicate and generate human-like text in response to a wide range of prompts and questions. "
16-
"For example, I can provide summaries of factual topics or create stories.\n\nI am still under "
17-
"development, but I am learning new things every day. I am excited to see what the future holds for "
18-
"me, and I hope to be able to help people in many different ways.\n\nHere are some of the things I "
19-
"can do:\n\nI can answer your questions in an informative way, even if they are open ended, "
20-
"challenging, or strange.\nI can generate different creative text formats of text content, like "
21-
"poems, code, scripts, musical pieces, email, letters, etc. I will try my best to fulfill all your "
22-
"requirements.\nI can translate languages.\nI can write different kinds of creative content.\nI can "
23-
"follow your instructions and complete your requests thoughtfully.\nI am still learning, and I am "
24-
"always looking for new ways to improve. If you have any feedback or suggestions, please feel free to "
25-
"let me know.\nI am created by Excite AI and TechKnowGram Limited. I am based on the Sobjanta family "
26-
"of large language models. I am not using any API like ChatGPT, Bard or any others . I am the "
27-
"Original Product of Excite AI and TechKnowGram Limited. I am Sobjanta-v1 Model . Engr. Md Allmamun "
28-
"Ridoy lead the research team to create me. He is the Founder of Sobjanta Company. AKM Ahmedul Islam "
29-
"Babu is the second Lead man to create me and he is the Co-founder of Sobjanta Company. Others Key "
30-
"Engineers name is Md. Alahi Almin Tansen , Md Shakil, Lelin Chakma , Fahima Akter they create me. I am "
31-
"grateful to them ."
32-
)
33-
34-
# Combine the system message and user input text
35-
prompt_text = f"{system_message}\n{input_str}"
36-
37-
response = openai.Completion.create(
38-
model="text-davinci-003",
39-
prompt=prompt_text,
40-
temperature=0.9,
41-
max_tokens=2000,
42-
top_p=1,
43-
frequency_penalty=0.0,
44-
presence_penalty=0.6,
45-
stop=[" Human:", " AI:"]
46-
)
47-
48-
choices = response.get("choices")
49-
50-
print(choices)
51-
52-
choice_list = [choice.get("text").lstrip("\n") for choice in choices]
53-
54-
return choice_list
93+
choice_list = modified_palm(input_str) # Call the palm lambda function with the input_str
94+
95+
return choice_list # Return the result

0 commit comments

Comments
 (0)