addcorpbc commited on
Commit ·
97f322e
1
Parent(s): f7612b6
Remove unsupported Cobalt theme and use default theme
Browse files12345625 unmodified lines323334353637383940414243444546from transformers import AutoTokenizer, AutoModelForCausalLMimport gradio as grimport os# Authenticate using a token from environment variableshf_token = os.getenv("HFTOKEN")25 unmodified linesoutputs = model.generate(**inputs, max_new_tokens=200)return tokenizer.decode(outputs[0], skip_special_tokens=True)# Define the Gradio interface with cobalt-themed designinterface = gr.Blocks(theme=gr.themes.Cobalt()) # Set the theme to cobaltwith interface:# Create a layout with stacked input and outputwith gr.Row():with gr.Column():gr.Textbox(label="Describe your career interests and goals", lines=2) # Career input fieldgr.Textbox(label="Career Recommendations", lines=4) # Output field for career recommendations# Launch the Gradio appinterface.launch(share=True)123456725 unmodified lines333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980from transformers import AutoTokenizer, AutoModelForCausalLMimport gradio as grimport osimport time# Authenticate using a token from environment variableshf_token = os.getenv("HFTOKEN")25 unmodified linesoutputs = model.generate(**inputs, max_new_tokens=200)return tokenizer.decode(outputs[0], skip_special_tokens=True)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 Indicator2. The Indecisiveness Scale3. RIASEC4. The Career Thought Inventory5. The Career Values Card Sort"""words = message.split(" ")output = ""for word in words:output += word + " "yield output # Output progressivelytime.sleep(0.1) # Typing delay between words# Define the Gradio interface with default designinterface = gr.Blocks()with interface:# Welcome message that types out in the output fieldgr.Interface(fn=welcome_message,inputs=None,outputs=gr.Textbox(label="Welcome Message", interactive=False, elem_id="welcome-box"), # Output in the same boxtitle="AI-Powered Magic City Career Counselor", # Updated titledescription="Let’s start by exploring your career interests! You will see a welcome message typing out in the box below.")# Career recommendation input/outputgr.Interface(fn=recommend,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 titledescription="Provide a description of your career goals, and get personalized career suggestions!" # Description update)# Launch the Gradio app with default theme (no Cobalt)interface.launch(share=True)
app.py+42-8