Spaces:
Running
Running
naveenvenkatesh
commited on
Commit
•
21aca5a
1
Parent(s):
079e8aa
Update aggressive_content_finder.py
Browse files- aggressive_content_finder.py +15 -8
aggressive_content_finder.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
from PyPDF2 import PdfReader
|
2 |
-
|
3 |
import gradio as gr
|
4 |
|
5 |
|
@@ -13,7 +13,10 @@ class AggressiveContentFinder:
|
|
13 |
"""
|
14 |
Initialize the AggressiveContentFinder with your OpenAI API key.
|
15 |
"""
|
16 |
-
|
|
|
|
|
|
|
17 |
|
18 |
def _extract_aggressive_content(self, contract_text: str) -> str:
|
19 |
"""
|
@@ -33,12 +36,16 @@ class AggressiveContentFinder:
|
|
33 |
]
|
34 |
|
35 |
# Call OpenAI GPT-3.5-turbo
|
36 |
-
chat_completion =
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
|
|
42 |
response = chat_completion.choices[0].message.content
|
43 |
return response
|
44 |
|
|
|
1 |
from PyPDF2 import PdfReader
|
2 |
+
import openai
|
3 |
import gradio as gr
|
4 |
|
5 |
|
|
|
13 |
"""
|
14 |
Initialize the AggressiveContentFinder with your OpenAI API key.
|
15 |
"""
|
16 |
+
openai.api_type = os.getenv['api_type']
|
17 |
+
openai.api_base = os.getenv['api_base']
|
18 |
+
openai.api_version = os.getenv['api_version']
|
19 |
+
openai.api_key = os.getenv['api_key']
|
20 |
|
21 |
def _extract_aggressive_content(self, contract_text: str) -> str:
|
22 |
"""
|
|
|
36 |
]
|
37 |
|
38 |
# Call OpenAI GPT-3.5-turbo
|
39 |
+
chat_completion = openai.ChatCompletion.create(
|
40 |
+
engine="ChatGPT",
|
41 |
+
messages = conversation,
|
42 |
+
temperature=0.7,
|
43 |
+
max_tokens=800,
|
44 |
+
top_p=0.95,
|
45 |
+
frequency_penalty=0,
|
46 |
+
presence_penalty=0,
|
47 |
+
stop=None
|
48 |
+
)
|
49 |
response = chat_completion.choices[0].message.content
|
50 |
return response
|
51 |
|