feedbackGPT / app.py
jeevavijay10's picture
added examples
0f76f71
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
example1 = """Artificial Intelligence (AI) includes groups of technologies that cover different fields such as machine and deep learning, predictive analytics, process automation, speech recognition, biometrics, and natural language processing. AI is seen by many businesses as the answer to increasing costs of human employment and used in a large number of industries in different ways. It has allowed the implementation of smart cities, developments in the medical sciences, special effects in movies and even the management of back-office type work. However, major concerns have been raised by many critics, some who are from the ICT fields themselves, that the use of AI must be controlled to prevent an unethical takeover by machines over humans.
You are the Head of ICT in a large logistics organisation with over 200 staff, established around 20 years ago. Your organisation’s head office is based in Sydney but it operates in various states of Australia and some countries in the Oceania region as well. Your organisation provides end to end logistics solutions to a large number of companies including warehousing, manufacturing and mining. Some of your client companies are expanding and they would like you to provide logistical solutions based on AI.
As a result, your organisation is now exploring options to expand the business in the next five years to include services based on AI. As a part of their expansion plans, the CEO of your organisation has asked you to investigate the technology and types of applications that can be used to provide services to your clients in the warehousing, manufacturing and mining industries. On the other hand, he wants to ensure that ethical limits of using AI are also observed with the use of AI. You have to complete this investigation in the next three weeks and draft a report with some recommendations for the next Executive Management meeting."""
example2 = """Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."""
iface = gr.Interface(fn=chatbot,
inputs=gr.inputs.Textbox(
label="Provide an assignment to evaluate."),
outputs="text",
title="Formative Feedback", examples=[example1, example2])
iface.launch()