Noobian commited on
Commit
0f2c706
·
1 Parent(s): 932dd7f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -4,10 +4,10 @@ import os
4
 
5
  openai.api_key = os.environ["AI_API_KEY"]
6
 
7
- def answer_question(question):
8
  response = openai.Completion.create(
9
  engine="text-davinci-002",
10
- prompt="Make a dua based on this prompt" " + question + "". and use this format: first praise allah using one of the appropriate 99 name then say peace be upon the prophet and then make the dua for what the user wants and then end it by giving thanks to allah",
11
  max_tokens=1024,
12
  n=1,
13
  stop=None,
@@ -15,7 +15,7 @@ def answer_question(question):
15
  ).get("choices")[0].text
16
  return response
17
 
18
- iface = gr.Interface(answer_question,
19
  gr.inputs.Textbox(lines=5, default="I am feeling overwhelmed?"),
20
  gr.outputs.Textbox(),
21
  title="Dua generator",
 
4
 
5
  openai.api_key = os.environ["AI_API_KEY"]
6
 
7
+ def make_dua(prompt):
8
  response = openai.Completion.create(
9
  engine="text-davinci-002",
10
+ prompt="Make a dua to relieve the feeling based on this prompt: " + prompt,
11
  max_tokens=1024,
12
  n=1,
13
  stop=None,
 
15
  ).get("choices")[0].text
16
  return response
17
 
18
+ iface = gr.Interface(make_dua,
19
  gr.inputs.Textbox(lines=5, default="I am feeling overwhelmed?"),
20
  gr.outputs.Textbox(),
21
  title="Dua generator",