tommy24 commited on
Commit
65931ad
·
1 Parent(s): e555041

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -13
app.py CHANGED
@@ -30,19 +30,24 @@ def greet(prompt):
30
  response = "I was created by Dawn Saju, Alwin Mathew, Sivai Bala, Bryan Godwin and Mohammed Zaim"
31
  return response
32
  else:
33
- ai.api_key = os.environ.get("test")
34
- response = ai.Completion.create(
35
- engine="text-davinci-003",
36
- prompt=prompt,
37
- temperature=0,
38
- max_tokens=2000,
39
- top_p=1,
40
- frequency_penalty=0,
41
- presence_penalty=0)
42
- if response != 500:
43
- response = response['choices'][0]['text']
44
- response = response.strip()
45
- result = base64.b64encode(response.encode('utf-8'))
 
 
 
 
 
46
  result2 = result.decode('utf-8')
47
  # response = "\n",response,"\n"
48
  return result2
 
30
  response = "I was created by Dawn Saju, Alwin Mathew, Sivai Bala, Bryan Godwin and Mohammed Zaim"
31
  return response
32
  else:
33
+ # ai.api_key = os.environ.get("test")
34
+ # response = ai.Completion.create(
35
+ # engine="text-davinci-003",
36
+ # prompt=prompt,
37
+ # temperature=0,
38
+ # max_tokens=2000,
39
+ # top_p=1,
40
+ # frequency_penalty=0,
41
+ # presence_penalty=0)
42
+ message = requests.post("https://www.teach-anything.com/api/generate", json={
43
+ "prompt": [
44
+ prompt,
45
+ ]})
46
+
47
+ if message != 500:
48
+ data = response
49
+ data = str(data.content,"utf-8")
50
+ result = base64.b64encode(data.encode('utf-8'))
51
  result2 = result.decode('utf-8')
52
  # response = "\n",response,"\n"
53
  return result2