Update app.py
Browse files
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 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
|
|
|
|
|
|
|
|
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
|