arvindershinh commited on
Commit
cd87477
·
verified ·
1 Parent(s): 5a39c8a

add secret key

Browse files
Files changed (1) hide show
  1. Summarization.py +51 -50
Summarization.py CHANGED
@@ -1,51 +1,52 @@
1
- # Warning control
2
- import warnings
3
- warnings.filterwarnings('ignore')
4
-
5
- from typing import List
6
- import json
7
- from pydantic import BaseModel
8
- # from langchain_community.llms import HuggingFaceHub
9
- from langchain_huggingface import HuggingFaceEndpoint
10
- from crewai import Agent, Task, Crew
11
-
12
- import os
13
- from dotenv import load_dotenv, find_dotenv
14
- _ = load_dotenv(find_dotenv()) # read local .env file
15
- hf_api_key = os.environ['HF_API_KEY']
16
-
17
- llm = HuggingFaceEndpoint(
18
- repo_id="HuggingFaceH4/zephyr-7b-beta",
19
- huggingfacehub_api_token=hf_api_key,
20
- task="text-generation"
21
- )
22
-
23
- editor = Agent(
24
- role="Editor",
25
- goal="Extract the summary of user requirements based on the chat between user and Graphic designer. Chat: {chat}",
26
- backstory="You're working as an Editor"
27
- "You are provided with chat between user and graphic designer. Chat: {chat}."
28
- "Extract the summary of user requirements from the chat",
29
- llm=llm,
30
- allow_delegation=False,
31
- verbose=False
32
- )
33
-
34
-
35
- summary = Task(
36
- description=(
37
- "Provide the summary of user requirements based on the chat between user and Graphic designer. Chat: {chat}"
38
- ),
39
- expected_output="Summary of user requirements. output only summary",
40
- agent=editor,
41
- )
42
-
43
- crew = Crew(
44
- agents=[editor],
45
- tasks=[summary],
46
- verbose=False
47
- )
48
-
49
- def Summarizer(chat, userDefinedQuestions=None):
50
- result = crew.kickoff(inputs={"chat": chat})
 
51
  return result
 
1
+ # Warning control
2
+ import warnings
3
+ warnings.filterwarnings('ignore')
4
+
5
+ from typing import List
6
+ import json
7
+ from pydantic import BaseModel
8
+ # from langchain_community.llms import HuggingFaceHub
9
+ from langchain_huggingface import HuggingFaceEndpoint
10
+ from crewai import Agent, Task, Crew
11
+
12
+ import os
13
+ from dotenv import load_dotenv, find_dotenv
14
+ _ = load_dotenv(find_dotenv()) # read local .env file
15
+ # hf_api_key = os.environ['HF_API_KEY']
16
+ hf_api_key = os.getenv('HF_API_KEY')
17
+
18
+ llm = HuggingFaceEndpoint(
19
+ repo_id="HuggingFaceH4/zephyr-7b-beta",
20
+ huggingfacehub_api_token=hf_api_key,
21
+ task="text-generation"
22
+ )
23
+
24
+ editor = Agent(
25
+ role="Editor",
26
+ goal="Extract the summary of user requirements based on the chat between user and Graphic designer. Chat: {chat}",
27
+ backstory="You're working as an Editor"
28
+ "You are provided with chat between user and graphic designer. Chat: {chat}."
29
+ "Extract the summary of user requirements from the chat",
30
+ llm=llm,
31
+ allow_delegation=False,
32
+ verbose=False
33
+ )
34
+
35
+
36
+ summary = Task(
37
+ description=(
38
+ "Provide the summary of user requirements based on the chat between user and Graphic designer. Chat: {chat}"
39
+ ),
40
+ expected_output="Summary of user requirements. output only summary",
41
+ agent=editor,
42
+ )
43
+
44
+ crew = Crew(
45
+ agents=[editor],
46
+ tasks=[summary],
47
+ verbose=False
48
+ )
49
+
50
+ def Summarizer(chat, userDefinedQuestions=None):
51
+ result = crew.kickoff(inputs={"chat": chat})
52
  return result