File size: 729 Bytes
86ba94d
 
932dd7f
86ba94d
 
 
0f2c706
86ba94d
 
820e34f
86ba94d
 
 
 
 
 
 
0f2c706
86ba94d
 
 
 
 
d511e5f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import gradio as gr
import openai
import os

openai.api_key = os.environ["AI_API_KEY"]

def make_dua(prompt):
    response = openai.Completion.create(
        engine="text-davinci-002",
        prompt=" Taking only from the Holy Quran, Make a dua based on this prompt and give me sources: " + prompt,
        max_tokens=1024,
        n=1,
        stop=None,
        temperature=0.5,
    ).get("choices")[0].text
    return response

iface = gr.Interface(make_dua, 
                     gr.inputs.Textbox(lines=5, default="I am feeling overwhelmed?"),
                     gr.outputs.Textbox(), 
                     title="Dua generator", 
                     description="Get a dua based on how youre feeling.")

iface.launch()