DuaGenerator / app.py
Noobian's picture
Update app.py
d511e5f
raw
history blame contribute delete
729 Bytes
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()