Update app.py
Browse files
app.py
CHANGED
@@ -4,19 +4,22 @@ import os
|
|
4 |
import requests
|
5 |
|
6 |
def greet(prompt):
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
20 |
|
21 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
22 |
iface.launch()
|
|
|
4 |
import requests
|
5 |
|
6 |
def greet(prompt):
|
7 |
+
if "created you" in prompt or "made you" in prompt:
|
8 |
+
response = "I was created by Dawn Saju, Alwin Mathew, Sivai Bala and Bryan Godwin"
|
9 |
+
else:
|
10 |
+
ai.api_key = os.environ.get("KEY")
|
11 |
+
response = ai.Completion.create(
|
12 |
+
engine="text-davinci-003",
|
13 |
+
prompt=prompt,
|
14 |
+
temperature=0,
|
15 |
+
max_tokens=2000,
|
16 |
+
top_p=1,
|
17 |
+
frequency_penalty=0,
|
18 |
+
presence_penalty=0)
|
19 |
+
response = response['choices'][0]['text']
|
20 |
+
response = response.strip()
|
21 |
+
# response = "\n",response,"\n"
|
22 |
+
return response
|
23 |
|
24 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
25 |
iface.launch()
|