File size: 757 Bytes
b7acb6c a137849 b7acb6c b6f56cb d0e1d9b b7acb6c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import gradio as gr
import openai
import os
openai.api_key = os.environ["OPENAI_KEY"]
def answer_question(question):
response = openai.Completion.create(
engine="text-davinci-002",
prompt="GIven this description of an officer and an incident help me write and incident report to report this officer: " + question,
max_tokens=1024,
n=1,
stop=None,
temperature=0.7,
).get("choices")[0].text
return response
iface = gr.Interface(answer_question,
inputs="text", outputs="text",
title="Incident report generator ",
description="Describe any police encounter and the officer and this will generate an incident report.")
iface.launch() |