mcq_generation / app.py
Nikhitha2310's picture
Update app.py
77ce664 verified
raw
history blame contribute delete
707 Bytes
import transformers
from transformers import pipeline
import streamlit as st
import os
import openai
os.environ['OPENAI_API_KEY']='sk-proj-uHasdgbriPPlFMm99ZtJT3BlbkFJOl231YfdxCSNmQjVEpMX'
input=st.text_input("Enter the text")
response=openai.chat.completions.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": "Hello!, How can I assist you"},
{'role':'user','content':input}
]
)
response2=openai.chat.completions.create(
model="gpt-3.5-turbo",
messages=[
{"role": "assistant", "content": response.choices[0].message.content},
{'role':'user','content':'Give me 5 mcq questions based on the above content'}
]
)
st.write(response2.choices[0].message.content)