Spaces:
Running
Running
KarthickAdopleAI
commited on
Commit
•
cd254ee
1
Parent(s):
dd974ce
Update incompletesentencefinder.py
Browse files- incompletesentencefinder.py +13 -12
incompletesentencefinder.py
CHANGED
@@ -35,24 +35,25 @@ class IncompleteSentenceFinder:
|
|
35 |
Returns:
|
36 |
str: Incomplete sentences identified by GPT-3.
|
37 |
"""
|
|
|
|
|
|
|
|
|
|
|
38 |
conversation = [
|
39 |
{"role": "system", "content": "You are a helpful incomplete sentences finder"},
|
40 |
{"role": "user", "content": f"""list out the incomplete sentences in the following text: {text}"""}
|
41 |
]
|
42 |
|
43 |
# Call OpenAI GPT-3.5-turbo
|
44 |
-
chat_completion =
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
stop=None
|
53 |
-
)
|
54 |
-
response = chat_completion.choices[0].message.content
|
55 |
-
return response
|
56 |
|
57 |
def get_incomplete_sentence(self,pdf_file) -> str:
|
58 |
|
|
|
35 |
Returns:
|
36 |
str: Incomplete sentences identified by GPT-3.
|
37 |
"""
|
38 |
+
client = AzureOpenAI(api_key=os.getenv("AZURE_OPENAI_KEY"),
|
39 |
+
api_version="2023-07-01-preview",
|
40 |
+
azure_endpoint = os.getenv("AZURE_OPENAI_ENDPOINT")
|
41 |
+
)
|
42 |
+
|
43 |
conversation = [
|
44 |
{"role": "system", "content": "You are a helpful incomplete sentences finder"},
|
45 |
{"role": "user", "content": f"""list out the incomplete sentences in the following text: {text}"""}
|
46 |
]
|
47 |
|
48 |
# Call OpenAI GPT-3.5-turbo
|
49 |
+
chat_completion = client.chat.completions.create(
|
50 |
+
model = "ChatGPT",
|
51 |
+
messages = conversation,
|
52 |
+
max_tokens=1000,
|
53 |
+
temperature=0
|
54 |
+
)
|
55 |
+
response = chat_completion.choices[0].message.content
|
56 |
+
return response
|
|
|
|
|
|
|
|
|
57 |
|
58 |
def get_incomplete_sentence(self,pdf_file) -> str:
|
59 |
|