feedbackGPT / app.py
jeevavijay10's picture
prototype of feedback with ai
9694995
raw
history blame
1.53 kB
import gradio as gr
import os
import openai
openai.api_type = os.environ["OPENAI_API_TYPE"]
openai.api_base = os.environ["OPENAI_API_BASE"]
openai.api_version = os.environ["OPENAI_API_VERSION"]
openai.api_key = os.environ["OPENAI_API_KEY"]
def chatbot(inputAssignment):
choices = openai.ChatCompletion.create(
engine="Itekgpt35",
messages=[
{"role": "system",
"content": "•\tYou are an Assistive chatbot whose primary goal is to help teachers with providing feedbacks on student's work. \n•\tProvide concise replies that are polite and professional. \n•\tDo not answer questions that are not related to academics and respond with \"I can only help with any academic questions you may have.\". \n•\tIf you do not know the answer to a question, respond by saying “I do not know the answer to your question. You may be able to find your answer with a teacher”"},
{"role": "user",
"content": f"Evaluate the following assignment.\n${inputAssignment}"},
],
temperature=0,
max_tokens=800,
top_p=0.95,
frequency_penalty=0,
presence_penalty=0,
stop=None)
response = choices.choices[0].message.content
print(response)
return response
iface = gr.Interface(fn=chatbot,
inputs=gr.inputs.Textbox(
label="Provide an assignment to evaluate."),
outputs="text",
title="Formative Feedback")
iface.launch()