addcorpbc commited on
Commit ·
fefaa5a
1
Parent(s): e1b5d77
Add AI-Powered Magic City Career Counselor with dynamic welcome message
Browse files123456725 unmodified lines333435353637383940414243444546474849503637383940414243444546474849505152535455565257585960566162636465666768697071727374757677787980818283848559606186878889909165669293from transformers import AutoTokenizer, AutoModelForCausalLMimport gradio as grimport osimport time
# Authenticate using a token from environment variableshf_token = os.getenv("HFTOKEN")25 unmodified lines outputs = model.generate(**inputs, max_new_tokens=200) return tokenizer.decode(outputs[0], skip_special_tokens=True)
# Add Markdown for welcome messagewelcome_message = """# AI-Powered Magic City Career CounselorHi, I'm your Magic City Career Counselor! Big Magic made me to help you plan for your future. He cares about his employees and wants to make sure you have a future after Magic City. To do that, we've consulted dozens of experts to help you decide on the direction you may want to take in the future.
We offer five different assessments you can take, or we can simply chat about your plans. The assessments include: 1. The Myers-Briggs Type Indicator 2. The Indecisiveness Scale 3. RIASEC 4. The Career Thought Inventory 5. The Career Values Card Sort
If you'd like to know more about what these assessments cover, just ask! Then, we can decide on which one(s) to take to better understand what might suit you."""def welcome_message(): """ Simulate typing out the welcome message in the output box. """ message = """Hi, I'm your Magic City Career Counselor! Big Magic made me to help you plan for your future. He cares about his employees and wants to make sure you have a future after Magic City. To do that, we've consulted dozens of experts to help you decide on the direction you may want to take in the future. We offer five different assessments you can take, or we can simply chat about your plans. The assessments include: 1. The Myers-Briggs Type Indicator 2. The Indecisiveness Scale 3. RIASEC 4. The Career Thought Inventory 5. The Career Values Card Sort """ words = message.split(" ") output = "" for word in words: output += word + " " yield output # Output progressively time.sleep(0.1) # Typing delay between words
# Define the Gradio interface# Define the Gradio interface with cobalt-themed designinterface = gr.Blocks()
with interface: gr.Markdown(welcome_message) # Display the welcome message explicitly gr.Markdown("""# AI-Powered Magic City Career Counselor Hi, I'm your Magic City Career Counselor! Big Magic made me to help you plan for your future. He cares about his employees and wants to make sure you have a future after Magic City. To do that, we've consulted dozens of experts to help you decide on the direction you may want to take in the future. We offer five different assessments you can take, or we can simply chat about your plans. The assessments include: 1. The Myers-Briggs Type Indicator 2. The Indecisiveness Scale 3. RIASEC 4. The Career Thought Inventory 5. The Career Values Card Sort
If you'd like to know more about what these assessments cover, just ask! Then, we can decide on which one(s) to take to better understand what might suit you.""")
# Welcome message that types out in the output field gr.Interface( fn=welcome_message, inputs=None, outputs=gr.Textbox(label="Welcome Message", interactive=False, elem_id="welcome-box"), # Output in the same box title="Welcome to the Magic City Career Counselor", description="Let’s start by exploring your career interests! You will see a welcome message typing out in the box below." )
# Career recommendation input/output gr.Interface( fn=recommend, inputs=gr.Textbox(label="Describe your career interests and goals"), outputs="text", title="AI-Powered Magic City Career Counselor", # Title update inputs=gr.Textbox(label="Describe your career interests and goals", lines=2, elem_id="input-box"), outputs=gr.Textbox(label="Career Recommendations", lines=4, elem_id="output-box"), title="AI-Powered Magic City Career Counselor", # Updated title description="Provide a description of your career goals, and get personalized career suggestions!" # Description update )
# Launch the Gradio appinterface.launch()# Set the theme color to cobalt for the Gradio UIinterface.launch(share=True, theme="cobalt") # `cobalt` theme for stylingapp.py+50-23