| import gradio as gr |
| import openai |
| import os |
|
|
| openai.api_key = os.environ.get("openaiapi") |
|
|
| def show(t0, context): |
| prompt = '''Given the definition of SDG 16 (Sustainable Development Goal 16): a goal adopted by the United Nations in the 2030 Agenda for Sustainable Development. It seeks to promote peaceful and inclusive societies for sustainable development, provide access to justice for all, and build effective, accountable, and inclusive institutions at all levels. SDG 16 has specific targets aimed at reducing violence, strengthening the rule of law, and combating corruption and terrorism, among other things.\n\nand context: {}\n\nDoes the above context satisfy or meet the SDG 16 goal as stated ? Answer 'yes' or 'no'. If unsure say 'I dont know'.'''.format(context) |
| |
| return prompt, complete(prompt) |
| |
|
|
| demo = gr.Interface( |
| show, |
| [ |
| |
| gr.Markdown("# Context Aware GPT3 - JusticeIQ😄"), |
| |
| |
| gr.Textbox( |
| lines=3, label="Contextual Information from Legal Document" |
| ), |
| |
| ], |
| outputs=[gr.components.Textbox(lines=3, label="Input Prompt"), |
| gr.components.Textbox(lines=3, label="Output: GPT3 Davinci Model")], |
| ) |
|
|
|
|
| demo.launch() |