File size: 992 Bytes
c72f44e
52a3e2b
 
c72f44e
 
5a13860
c72f44e
5a13860
b286257
 
5a13860
 
b286257
d683750
d795dfd
b286257
d071333
b286257
 
5a13860
 
b286257
5a13860
b286257
 
5a13860
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import streamlit as st
#from langchain.llms import OpenAI
from langchain_community.llms import OpenAI


st.title("🔗 Test Creator")

def test_creator(topic):
    # Enhanced prompt with additional context for better post generation
    prompt = (
        f" Develop a test to identify the modules you need to learn to become a {topic} developer."
        "The test should assess your understanding and proficiency in these areas to provide guidance on which modules to focus on for further learning in {topic} development."
    )
    
    llm = OpenAI(temperature=0.7, openai_api_key=st.secrets["OPENAI_API_KEY"])
    response = llm(prompt)
    return response

with st.form("my_form"):
    topic = st.text_area("Enter the Technology you want to test.")
    submitted = st.form_submit_button("Generate Test")
    if submitted and topic:
        post = test_creator(topic)
        st.info(post)
    elif submitted and not topic:
        st.error("Please enter a technology to generate test.")