jobanpreet123 commited on
Commit
457e1fe
1 Parent(s): c736ca5
.env ADDED
@@ -0,0 +1 @@
 
 
1
+ cohere_api_key="CTx2vcy4vjHeGC77cGGQXrCCz4xZYxlnPyFWZqqe"
__pycache__/advance_post.cpython-310.pyc CHANGED
Binary files a/__pycache__/advance_post.cpython-310.pyc and b/__pycache__/advance_post.cpython-310.pyc differ
 
__pycache__/paraphrase_post.cpython-310.pyc CHANGED
Binary files a/__pycache__/paraphrase_post.cpython-310.pyc and b/__pycache__/paraphrase_post.cpython-310.pyc differ
 
__pycache__/scrap_post.cpython-310.pyc CHANGED
Binary files a/__pycache__/scrap_post.cpython-310.pyc and b/__pycache__/scrap_post.cpython-310.pyc differ
 
app.py CHANGED
@@ -4,7 +4,9 @@ import openai
4
  from paraphrase_post import get_original_url , paraphrased_post
5
  from advance_post import google_search , advanced_post
6
  from langchain_community.chat_models import ChatOpenAI
7
- from langchain_groq import ChatGroq
 
 
8
  #from langchain import HuggingFaceHub
9
 
10
 
@@ -27,7 +29,7 @@ def main():
27
  session_state.advancepost = ""
28
 
29
  url = st.sidebar.text_input("Enter URL:", placeholder="Enter URL here...")
30
- option = st.sidebar.selectbox('Select Model:', ('GPT-4',"Mixtral-8x7b","Gemma-7b"))
31
  temperature= st.sidebar.select_slider(
32
  'How much accurate post you want ?',
33
  options=['Less accuracy', 9, 8, 7, 6, 5,4,3 ,2,1,'High accuracy'])
@@ -42,14 +44,16 @@ def main():
42
  api_key=st.sidebar.text_input("API Key:",placeholder="Enter OpenAI API Key...")
43
  if api_key:
44
  model=ChatOpenAI(model="gpt-4-turbo-preview" , temperature=temperature , api_key=api_key)
45
- elif option=="Mixtral-8x7b":
46
- api_key= st.sidebar.text_input("API Key:",placeholder="Enter Groq API Key...")
47
- if api_key:
48
- model = ChatGroq(temperature=temperature,groq_api_key=api_key, model_name="mixtral-8x7b-32768")
49
- elif option=="Gemma-7b":
50
- api_key=st.sidebar.text_input("API Key:",placeholder="Enter Groq API Key...")
51
  if api_key:
52
- model= ChatGroq(temperature=temperature,groq_api_key=api_key , model_name="Gemma-7b-It")
 
 
 
 
 
 
53
 
54
 
55
  # elif option=="Llama-3":
@@ -78,8 +82,15 @@ def main():
78
  else:
79
  st.sidebar.error("Please enter url")
80
 
81
-
82
-
 
 
 
 
 
 
 
83
  paraphrase_text=st.text_area("Generated LinkedIn post",value=session_state.paraphrase, height=400)
84
  # import pyperclip
85
  # if st.button('Copy'):
 
4
  from paraphrase_post import get_original_url , paraphrased_post
5
  from advance_post import google_search , advanced_post
6
  from langchain_community.chat_models import ChatOpenAI
7
+ from langchain_cohere import ChatCohere
8
+ # from langchain_nvidia_ai_endpoints import ChatNVIDIA
9
+
10
  #from langchain import HuggingFaceHub
11
 
12
 
 
29
  session_state.advancepost = ""
30
 
31
  url = st.sidebar.text_input("Enter URL:", placeholder="Enter URL here...")
32
+ option = st.sidebar.selectbox('Select Model:', ('GPT-4',"Cohere"))
33
  temperature= st.sidebar.select_slider(
34
  'How much accurate post you want ?',
35
  options=['Less accuracy', 9, 8, 7, 6, 5,4,3 ,2,1,'High accuracy'])
 
44
  api_key=st.sidebar.text_input("API Key:",placeholder="Enter OpenAI API Key...")
45
  if api_key:
46
  model=ChatOpenAI(model="gpt-4-turbo-preview" , temperature=temperature , api_key=api_key)
47
+ elif option=="Cohere":
48
+ api_key= st.sidebar.text_input("API Key:",placeholder="Enter Cohere API Key...")
 
 
 
 
49
  if api_key:
50
+ model = ChatCohere(cohere_api_key=api_key , temperature = temperature , model = "command-r-plus")
51
+ # elif option=="Mixtral-8x7b":
52
+ # api_key=st.sidebar.text_input("API Key:",placeholder="Enter NVIDIA NIM API Key...")
53
+ # if api_key:
54
+ # model = ChatNVIDIA(model="mixtral_8x7b",api_key = api_key , temperature=temperature)
55
+
56
+
57
 
58
 
59
  # elif option=="Llama-3":
 
82
  else:
83
  st.sidebar.error("Please enter url")
84
 
85
+ # def stream_data():
86
+ # import time
87
+ # for word in session_state.paraphrase.split(" "):
88
+ # yield word + " "
89
+ # time.sleep(0.02)
90
+
91
+
92
+ # st.write_stream(word +" ")
93
+
94
  paraphrase_text=st.text_area("Generated LinkedIn post",value=session_state.paraphrase, height=400)
95
  # import pyperclip
96
  # if st.button('Copy'):
paraphrase_post.py CHANGED
@@ -46,8 +46,8 @@ def paraphrased_post(url,model):
46
  post=scrappost(url)
47
  # print(post)
48
 
49
- template="""You are a helpful paraphraser tool. You are provided with a content and your task is to paraphrase it.
50
- {data}"""
51
 
52
  prompt = ChatPromptTemplate.from_template(template)
53
 
 
46
  post=scrappost(url)
47
  # print(post)
48
 
49
+ template=""" You are provided with LinkedIn post below . Paraphrase this post in professional way.You can change the writing style as compared to the provided post .Keep stickers , emojis , links and hastags. Final output should only be paraphrased post .
50
+ LinkedIn post: {data}"""
51
 
52
  prompt = ChatPromptTemplate.from_template(template)
53