import gradio as gr import os from huggingface_hub import InferenceClient # Connect to Hugging Face model client = InferenceClient( "HuggingFaceH4/zephyr-7b-beta", token=os.environ.get("HF_API_TOKEN") ) # Example Q&A pairs about Resilient Coders rc_qa_examples = [ #GENERAL Q'S ("What is Resilient Coders?", "Resilient Coders is a free and stipended coding bootcamp that trains people of color for careers as software engineers. Everything we do serves our goal of economic liberation. To that end, there is no tuition, and you never have to pay us back -- not even after you get a job. Free is free. We also provide a $500 learning stipend so you can focus on your learning. This stipend is paid bi-weekly."), ("Is the bootcamp free?", "Yes, the bootcamp is completely free and includes a stipend."), ("How long is the program?", "It usually runs about 20 weeks."), ("Do I need to know how to code?", "No prior experience is required. We train participants from the ground up."), ("Is your program in person or online?", "Resilient Coders is 100% remote, so all of our classes are online. However, you must meet our eligibility requirements in order to participate."), ("What skills does Resilient Coders Teach", "Our coders virtually meet, every day, and start off learning HTML and CSS, then take a deep dive into Javascript, Node, MongoDB and React. They build multiple projects each week and have the support of program team, mentors, and alumni during their coding journeys. Students also work on the skills that make the whole engineer during bootcamp. Our staff helps them build on their essential communication techniques, public speaking strategies, best time management practices, professional portfolios, and interviewing skills."), ("What are the eligibility requirements?","Must 18yrs-35yrs old, if older please still apply. Minimum High school diploma or GED. Please note that our program focuses on people who have limited access to traditional educational pathways. Unfortunately, we can’t admit candidates with advanced post-secondary degrees (MBA, PhD, etc). Resident in the Greater Boston, Greater Philadelphia and Greater Maine areas. We are open to applicants from neighboring states, this include Delaware, New Jersey, New Hampshire, and Rhode Island. Individuals from neighboring states will be accepted on a case by case basis. You are ready and eligible to work in the United States. You can commit to working as a software engineer immediately following the bootcamp. Low-income (based on [HUD guidelines](https://www.huduser.gov/portal/datasets/il.html)). You watched this [free one hour class](https://www.youtube.com/watch?v=RAQ3vKV7nAE). You are in the process of completing or have completed the [responsive design coursework](https://www.freecodecamp.org/learn/2022/responsive-web-design/)."), ("How much is the stipend?", "Those admitted into the training program receive a $500 bi-weekly learning stipend."), ("When is the deadline?", "Applications are not yet open for the Fall 2025 Cohort. Please submit an [Interest Form](https://share.hsforms.com/1A49LbeAJQA6KI7xNufctbws5jn7) to receive notifications."), ("What do you look for in a candidate, besides eligibility?", "We also look for characteristics that lead to success in the program—like curiosity, collaboration, and persistence. These aren't hard requirements. [Learn more in the student journey.](https://www.notion.so/Student-Journey-744b99ef29c54313b5c2972df95c8196?pvs=21)"), ("What is the application process?", "Step 1: [Watch this free class](https://www.youtube.com/watch?v=RAQ3vKV7nAE). Step 2: [Submit your application](https://resilientcoders.org/application). Step 3: If eligible, you’ll be invited to a hackathon. Step 4: Interview. Step 5: Paperwork and onboarding."), ("What happens after I submit the application?", "You'll get an email confirmation. If you meet eligibility requirements, you'll be invited to a hackathon. If you don’t hear back after 7–10 business days, reach out to recruiting@resilientcoders.org."), ("When are the hackathons?", "The schedule for the hackathons will be posted as soon as the application is open."), ("Do I have to attend a hackathon to be considered?", "Yes! It's required. If eligible, you’ll get an invite. Hackathons are fully online using [Remo](http://remo.co) and [Glitch](https://glitch.com/)."), ("Do you have any advice for the hackathon?", "Yes! Watch the intro class, be enthusiastic, ask questions, collaborate, and be yourself. Hackathons are online, and you’ll need a mic and camera. [More about Remo](http://remo.co), [More about Glitch](https://glitch.com/)."), ("Will I need a computer to participate in the hackathon?", "Yes, you need a laptop or desktop with mic, camera, and internet access. Phones won’t work. [Test your gear here.](https://live.remo.co/geartest)"), ("What happens during the final interview?", "The team will want to get to know you—your story, interest in Resilient Coders, and your commitment. [Review the student journey](https://www.notion.so/Student-Journey-744b99ef29c54313b5c2972df95c8196?pvs=21) and [interview tips](https://hbr.org/2021/03/4-tips-to-nail-a-virtual-job-interview)."), ("I was rejected before, can I still apply?", "Yes! We encourage re-applications. [Explore the student journey](https://www.notion.so/Student-Journey-744b99ef29c54313b5c2972df95c8196?pvs=21), and consider [FreeCodeCamp](https://www.freecodecamp.org/learn/responsive-web-design/) or [#100Devs](https://www.twitch.tv/learnwithleon/about) to keep learning."), ("I have a criminal record, can I apply?", "Yes! Your record won't disqualify you. We ask so we can avoid placing you with employers who have restrictions."), ("I have a college degree, can I apply?", "Yes, but we prioritize those with limited access to traditional education. We limit college grads per cohort. Candidates with advanced degrees (MBA, PhD) are not eligible."), ("I’m a parent, can I apply?", "Yes! Many alumni are parents. Just be sure you can attend class 10am–3pm and participate in hiring events."), ("I’m over 35 years old, can I apply?", "In 2023, we raised the age cap to 35. We consider demographic, location, income, education, and other factors due to our nonprofit funding requirements."), #BOOTCAMP Q'S ( "Can you tell me more about what happens during the program?", "The program is all day, every day, for 18 weeks, fully remote." "[You can learn more about how the bootcamp breaks down in the student journey.](https://www.notion.so/Student-Journey-744b99ef29c54313b5c2972df95c8196?pvs=21) " "To remain in the program, you're required to meet expectations with technical and professional development assignments." "These are assessed every 3–4 weeks. Falling short without prior communication or behaving unprofessionally may result in a redirect." ), ( "What is a redirect?", "Resilient Coders pays a $500 bi-weekly learning stipend to support full-time commitment." "However, to remain enrolled, you must meet expectations in technical and professional development work." "These are reviewed every 3–4 weeks. If expectations aren’t met—or if behavior is unfit for the program or workforce—you may be redirected, meaning you’re no longer enrolled and your stipend ends immediately." ), ( "Can I do the program while working?", "The program is intensive, fast-paced, and full-time for 5 months. Most students cannot maintain a job while enrolled." "Only a few alumni have managed part-time jobs successfully. If accepted, you are committing to meet all bootcamp goals and expectations." ), ( "Do you help graduates find jobs?", "Yes. We offer career resources, internal hiring events, and require participation in networking events." "**However, Resilient Coders cannot guarantee a job.** Post-graduation, you’ll have access to a 3-month support program, including [huntr.co](http://huntr.co) for job tracking, weekly cohort check-ins, and continued technical training." ), ( "What kind of jobs do your alumni get?", "Our graduates are hired in tech roles like:\n\n" "- Software Engineer Apprentice\n" "- Associate Javascript Engineer\n" "- Software Developer / Software Engineer / Software Engineer I\n" "- Junior Software Engineer / Jr Developer\n" "- Software Development Engineer\n" "- Software Development Engineer Apprentice\n" "- Applications Developer\n" "- Presentation Engineer\n" "- Associate Consultant in Salesforce / Tech Associate Consultant\n" "- Associate Software Engineer\n" "- Marketing Engineer\n" "- Product Engineering Associate\n" "- Front-End Engineer\n" "- Technical Operations Manager\n" "- Data Integration Lead\n" "- Technical Data Analyst" ), ( "What companies hire out of Resilient Coders?", "Our graduates work at a wide range of companies—from large firms like Amazon Audible, Wayfair, and Cargurus to health tech companies like Athenahealth and Humana, " "as well as agencies, consulting firms, non-profits, higher education institutions, and startups." ), ( "How much money are your grads making?", "Salaries vary by region, industry, and company size. Here’s reported average salary data for grads who found jobs:\n\n" "- **2019**: $98k [See report](https://f.hubspotusercontent40.net/hubfs/2253693/Docs/Annual%20reports/AnnualReport2019.pdf)\n" "- **2020**: $81k [See report](https://f.hubspotusercontent40.net/hubfs/2253693/Docs/Annual%20reports/AnnualReport2020.pdf)\n" "- **2021**: $94.4k [See report](http://www.resilientcoders.org/documents/Annual-Report-2021-April.pdf)\n\n" "2022 data will be reported later." ), #OTHER Q'S ( "I’m under 18, are there other programs I can check out?", "If you are in the Boston area, check out [futureBOS](https://www.boston.gov/departments/youth-employment-and-opportunity/summer-youth-jobs), " "a one-stop shop that connects Boston residents ages 14–24 to youth jobs, internships, and paid opportunities across the city. " "It centralizes youth job opportunities and resources.\n\n" "Also look into [The Possible Zone](https://possiblezone.org/), which works with high school students and offers multiple programs, including STEAM deep dives. " "Their mission is to advance economic equity through entrepreneurship education. [Here’s their FAQ.](https://possiblezone.org/students/faq/)" ), ( "I don’t qualify for Resilient Coders but I still want to learn how to code?", "We’re excited you want to continue your software engineering journey! Here are some great resources to start with:\n\n" "- [Responsive Web Design course](https://www.freecodecamp.org/learn/responsive-web-design/#basic-html-and-html5) on freeCodeCamp\n" "- Watch this TED Talk: [Learning how to Learn](https://www.youtube.com/watch?utm_campaign=Recruitment+2022&utm_medium=email&_hsmi=204433415&_hsenc=p2ANqtz-8x8_ETWLEYyZOQINCOApJJ2w389LgAwnvM3_hgGd5v5v07zi4jguYzAZfS42xFaVqWbs0fZTFXOvM7ZUEZ4pcxXIvh-fuCannp4Uhb6i-fT33gRnw&utm_content=204433415&utm_source=hs_email&v=O96fE1E-rf8&feature=youtu.be)\n" "- Follow [Learn With Leon](https://www.twitch.tv/learnwithleon/about) on Twitch for beginner-friendly engineering content" ), ( "I don’t qualify, are there other programs like Resilient Coders?", "Yes, here are similar free or affordable bootcamps and learning opportunities:\n\n" "- [Apprenti](https://apprenticareers.org/?utm_campaign=Recruitment%202022&utm_source=hs_email&utm_medium=email&_hsenc=p2ANqtz-8yWPR_jX7W-59HeujiDI9jHnJ0JrG3hJv6Pssw8G_euC2AWIv1mJF0gfMiz04oZWAoAnyM): Nationwide, free training and job placement\n" "- In Philadelphia: [Out Got Tech Training](https://futureworksphl.com/got-tech-training-2?utm_campaign=Recruitment%202022&utm_source=hs_email&utm_medium=email&_hsenc=p2ANqtz-8yWPR_jX7W-59HeujiDI9jHnJ0JrG3hJv6Pssw8G_euC2AWIv1mJF0gfMiz04oZWAoAnyM), featuring [LaunchCode](https://www.launchcode.org/get-started?utm_campaign=Recruitment%202022&utm_source=hs_email&utm_medium=email&_hsenc=p2ANqtz-8yWPR_jX7W-59HeujiDI9jHnJ0JrG3hJv6Pssw8G_euC2AWIv1mJF0gfMiz04oZWAoAnyM)\n" "- [#100Devs](https://www.twitch.tv/learnwithleon/about) by Leon Noel: free online software engineering evening class\n" "- Explore listings on [CourseReport](https://www.coursereport.com/?utm_campaign=Recruitment%202022&utm_source=hs_email&utm_medium=email&_hsenc=p2ANqtz-8yWPR_jX7W-59HeujiDI9jHnJ0JrG3hJv6Pssw8G_euC2AWIv1mJF0gfMiz04oZWAoAnyM) and [CareerKarma](https://careerkarma.com/blog/best-free-coding-bootcamps/)" ), ( "Do you know of any other STEM programs?", "Yes! Here are a few free programs you can look into (not official endorsements by Resilient Coders):\n\n" "- [Apprenti](https://apprenticareers.org/?utm_campaign=Recruitment%202023&utm_source=hs_email&utm_medium=email&_hsenc=p2ANqtz-8706O8Hy8_bgibcrBpI3pLodUFtkJX2Ew1WbWZnFWCCcmZYEEMwXEPH4J0ju1_F3bki-mm): Free nationwide training + guaranteed job placement\n" "- [Per Scholas](https://perscholas.org/?utm_campaign=Recruitment%202023&utm_source=hs_email&utm_medium=email&_hsenc=p2ANqtz-8706O8Hy8_bgibcrBpI3pLodUFtkJX2Ew1WbWZnFWCCcmZYEEMwXEPH4J0ju1_F3bki-mm): Free tech and professional development training in multiple cities (stipends may be available)\n" "- **Boston-area programs:**\n" " - [Franklin Cummings Tech](https://franklincummings.edu/academics/academic-programs/software-development): Pell-eligible students can access free certification programs\n" " - [MassBioEd Apprenticeships](https://www.massbioed.org/students-career-seekers/apprenticeships): Biotech apprenticeships in clinical trials, biomanufacturing, and lab support\n" " - [Just A Start](https://justastart.org/adult-career-training): Free training in Biomedical and IT Careers" ) ] # Main response function def respond(message, history, system_message, max_tokens, temperature, top_p): # Format prompt messages = [{"role": "system", "content": system_message}] for q, a in rc_qa_examples: messages.append({"role": "user", "content": q}) messages.append({"role": "assistant", "content": a}) for user_msg, bot_reply in history: if user_msg: messages.append({"role": "user", "content": user_msg}) if bot_reply: messages.append({"role": "assistant", "content": bot_reply}) messages.append({"role": "user", "content": message}) # Stream response response = "" for chunk in client.chat_completion( messages=messages, max_tokens=max_tokens, temperature=temperature, top_p=top_p, stream=True ): delta = chunk.choices[0].delta.content if delta: response += delta yield response # Gradio UI demo = gr.ChatInterface( fn=respond, additional_inputs=[ gr.Textbox(value="You are a helpful assistant trained *only* on verified content from https://www.resilientcoders.org. If a user asks anything not covered by the provided examples, respond with: 'I'm still learning. Please contact hello@resilientcoders.org for more info.' Never speculate or use outside data.", label="System message"), gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max tokens"), gr.Slider(minimum=0.1, maximum=2.0, value=0.7, step=0.1, label="Temperature"), gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p"), ], title="Resilient Coders FAQ Chatbot", description="Ask anything about Resilient Coders bootcamp!" ) if __name__ == "__main__": demo.launch()