Pamudu13 commited on
Commit
f91c6d5
·
verified ·
1 Parent(s): cd0eb56

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -18,9 +18,8 @@ logger = logging.getLogger('my_flask_app')
18
  openai.api_base = "https://api.pawan.krd/unfiltered/v1"
19
  openai.api_key = "pk-IDpTrFbbikTWTSUdJsckGStERwgiZCdaCznbKagvOAVxAftU"
20
 
 
21
  history = []
22
- first_message = True
23
- file_name = "Default"
24
  chatbot_name = "Lunar Ai"
25
  word_limit = 2000
26
 
@@ -57,7 +56,8 @@ def chat_bot():
57
 
58
  corrected_sentences = []
59
  for sentence in sentences:
60
- history = [
 
61
  {"role": "system", "content": system_message},
62
  {"role": "user", "content": sentence}
63
  ]
@@ -65,8 +65,8 @@ def chat_bot():
65
  # Correct each sentence individually
66
  response = openai.ChatCompletion.create(
67
  model="gpt-3.5-turbo",
68
- messages=history,
69
- max_tokens=50
70
  )
71
 
72
  corrected_sentence = response['choices'][0]['message']['content']
 
18
  openai.api_base = "https://api.pawan.krd/unfiltered/v1"
19
  openai.api_key = "pk-IDpTrFbbikTWTSUdJsckGStERwgiZCdaCznbKagvOAVxAftU"
20
 
21
+ # Initialize variables
22
  history = []
 
 
23
  chatbot_name = "Lunar Ai"
24
  word_limit = 2000
25
 
 
56
 
57
  corrected_sentences = []
58
  for sentence in sentences:
59
+ # Create history for each sentence
60
+ individual_history = [
61
  {"role": "system", "content": system_message},
62
  {"role": "user", "content": sentence}
63
  ]
 
65
  # Correct each sentence individually
66
  response = openai.ChatCompletion.create(
67
  model="gpt-3.5-turbo",
68
+ messages=individual_history,
69
+ max_tokens=150 # Increase max_tokens to allow for longer responses
70
  )
71
 
72
  corrected_sentence = response['choices'][0]['message']['content']