File size: 1,418 Bytes
6a4040c
89a0cff
cc5a369
 
28b04ae
 
fe1521a
 
4007968
3e00ee2
5af59f0
 
c818378
0dacb0e
6a4040c
 
 
 
 
 
28b04ae
5addd04
28b04ae
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 os
os.system("pip install openai") 

import openai
import gradio as gr

model="gpt-3.5-turbo"

task =f""" Your task is to help a university lecturer create a project scope table for """
formatting = f"""Define what is the project objective, in scope, out of scope and assumptions. Do this in a tabular format. The table comprises six rows. The first row is a single column labeled "Project Objective". The second row is a single column stating the project objectives. The thid row contains two columns labeled "In Scope" and "Out of Scope". The fourth row contains two columns describing what is in scope and out of scope. The fifth row is a single column named "Assumptions". The sixth row is a single column describing the assumptions.  Below each of these name, populate with detail content relevant to each title."""
default_input = "I am looking to elevate our assessments and enable lecturers to develop more authentic assessments."

def get_completion(describe_your_project_idea_here):
    messages = [{"role": "user", "content": task + describe_your_project_idea_here + formatting}]
    response = openai.ChatCompletion.create(
        model=model,
        messages=messages,
        temperature=0, # this is the degree of randomness of the model's output
    )
    return response.choices[0].message["content"]

iface = gr.Interface(fn=get_completion, inputs="text", outputs="markdown")
iface.launch()