Downloads · 30 days
0
satyam9097/J-GPT
J-GPT is a machine learning model from satyam9097. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
0
Access
Public
Updated Sep 7, 2023
Repo size
—
Likes
1
Public
Click a slice to open those files.
Other3.7 KB · 63%
From the Hugging Face model README
import openai import gradio as gr
openai.api_key = "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"
messages = [ {"role": "system", "content": "You are a professor and career counsellor who mainly helps engineering diploma students with their studies, such as clearing doubts related to their branch or their future."} ]
def CustomChatGPT(user_input, engineering_branch, year_of_study): messages.append({"role": "user", "content": user_input}) response = openai.ChatCompletion.create( model="gpt-3.5-turbo", messages=messages ) ChatGPT_reply = response["choices"][0]["message"]["content"] messages.append({"role": "assistant", "content": ChatGPT_reply}) return ChatGPT_reply
def validate_year_of_study(year_of_study): if year_of_study < 1 or year_of_study > 4: raise ValueError("Year of study should be between 1 and 4.")
inputs = [ gr.inputs.Textbox(label="User Input", placeholder="Enter your question or doubt here", lines=2), gr.inputs.Dropdown(["Mechanical Engineering", "Electrical Engineering", "Civil Engineering"], label="Engineering Branch"), gr.inputs.Number(label="Year of Study",) ] outputs = gr.outputs.Textbox(label="Assistant Reply")
title = "Digital Professor" description = "Ask questions and get assistance from the Digital Professor, a professor and career counsellor for engineering diploma students."
examples = [ ["What are the career prospects for mechanical engineering?", "The career prospects for mechanical engineering are diverse. You can work in industries such as automotive, aerospace, energy, and more."], ["Can you help me with my doubt related to electrical circuits?", "Of course! Please provide more details about your doubt related to electrical circuits."], ["What are the key skills required for a successful career in civil engineering?", "Some key skills required for a successful career in civil engineering include problem-solving, analytical thinking, and good communication skills."], ]
gr.Interface(fn=CustomChatGPT, inputs=inputs, outputs=outputs, title=title, description=description, examples=examples, theme="compact").launch()