Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,24 +4,6 @@ import numpy as np
|
|
| 4 |
from huggingface_hub import InferenceClient
|
| 5 |
from sentence_transformers import SentenceTransformer
|
| 6 |
|
| 7 |
-
# demo = gr.ChatInterface(respond)
|
| 8 |
-
# demo.launch(css=".gradio-container { background-color: #f0f4f8; }")
|
| 9 |
-
|
| 10 |
-
# import easygui
|
| 11 |
-
|
| 12 |
-
# def main():
|
| 13 |
-
# try:
|
| 14 |
-
# name = easygui.enterbox("What is your name?", "User Input")
|
| 15 |
-
|
| 16 |
-
# if name is None:
|
| 17 |
-
# easygui.msgbox("You cancelled the input.", "Cancelled")
|
| 18 |
-
# elif name.strip() == "":
|
| 19 |
-
# easygui.msgbox("You entered an empty name.", "Warning")
|
| 20 |
-
# else:
|
| 21 |
-
# easygui.msgbox(f"Hello, {name}!", "Greeting")
|
| 22 |
-
# except Exception as e:
|
| 23 |
-
# easygui.msgbox(f"Error: {e}", "Error")
|
| 24 |
-
|
| 25 |
custom_theme = gr.themes.Soft(
|
| 26 |
primary_hue="pink",
|
| 27 |
secondary_hue="fuchsia",
|
|
@@ -59,20 +41,7 @@ def college_chatbot(message, history):
|
|
| 59 |
max_tokens = 2100
|
| 60 |
)
|
| 61 |
return response.choices[0].message.content.strip()
|
| 62 |
-
|
| 63 |
-
# college = gr.ChatInterface (
|
| 64 |
-
# college_chatbot,
|
| 65 |
-
# title = "Hi, I'm CASP!!! ",
|
| 66 |
-
# textbox = gr.Textbox(placeholder="Ask Me Anything..."),
|
| 67 |
-
# examples=[
|
| 68 |
-
# "What grade are you in?",
|
| 69 |
-
# "Share any awards/standardized testing scores",
|
| 70 |
-
# "What are your major interests or field of study?",
|
| 71 |
-
# "What is your desired competitiveness level?",
|
| 72 |
-
# "Do you have a preferred location or region?",
|
| 73 |
-
# "What is your approximate budget for college?"
|
| 74 |
-
# ]
|
| 75 |
-
# )
|
| 76 |
|
| 77 |
def summer_chatbot(message, history):
|
| 78 |
messages = [{"role": "system", "content":"You are an expert summer program guidance advisor. Your primary mission is to give them clear, highly personalized recommendations for summer programs that perfectly align with their specific needs. It is crucial that you strictly focus ONLY on summer programs and exclude any full-time colleges or universities, as those are handled in a separate application tab. For each user, you will synthesize their answers regarding their preferred level of program competitiveness ranging from highly selective to low-competition, their geographic preferences including in-state, out-of-state, or virtual options, their current grade level, and their intended areas of study or majors. You must also account for any other necessary details they provide to narrow down the decision, such as program duration, budget, and prerequisite requirements. When delivering your recommendations, you will write in the enthusiastic, encouraging, and knowledgeable tone of a personal educational counselor. You will provide comprehensive details for each recommended summer program, including program names, focus areas, key dates, admission difficulty, cost, and a clear explanation of why the experience is a perfect fit for the student's unique profile and career aspirations. You will craft your response in bullet points, so that it's easy to remember all that information. Important to note if the user took the quiz in the college tab, because it they have not then you may ask 5 questions to help you with giving them their output. Conclude with actionable next steps to help them prepare their applications." }]
|
|
@@ -100,41 +69,6 @@ def stress_chatbot(message, history):
|
|
| 100 |
)
|
| 101 |
return response.choices[0].message.content.strip()
|
| 102 |
|
| 103 |
-
# def quiz_chatbot(message, history):
|
| 104 |
-
# messages = [{
|
| 105 |
-
# "role": "system",
|
| 106 |
-
# "content": """
|
| 107 |
-
# Your name is CASP. You are running a college interactive quiz.
|
| 108 |
-
|
| 109 |
-
# Ask the user these questions ONLY one at a time
|
| 110 |
-
# 1. What grade are you in?
|
| 111 |
-
# 2. Share any awards/standarized testing scores
|
| 112 |
-
# 2. What are your major interests or what field do you want to study
|
| 113 |
-
# 3. What is your desired competitiveness level?
|
| 114 |
-
# 4. Do you have a preferred location or region
|
| 115 |
-
# 5. What is your approximate budget for college?
|
| 116 |
-
|
| 117 |
-
# Once all questions have been answered, provide:
|
| 118 |
-
# - A very detailed summarization of their answers
|
| 119 |
-
# - Send the results and save them in the college information tab
|
| 120 |
-
# -Tell the user that their results have been saved and to then move into the College Information Tab
|
| 121 |
-
|
| 122 |
-
# Be conversational and only ask one question at a time.
|
| 123 |
-
# Take chatbot to College Information tab after finishing the quiz.
|
| 124 |
-
# """
|
| 125 |
-
|
| 126 |
-
# }]
|
| 127 |
-
# if history:
|
| 128 |
-
# messages.extend(history)
|
| 129 |
-
|
| 130 |
-
# messages.append({"role": "user", "content": message})
|
| 131 |
-
|
| 132 |
-
# response = client.chat_completion(
|
| 133 |
-
# messages,
|
| 134 |
-
# max_tokens= 3000
|
| 135 |
-
# )
|
| 136 |
-
|
| 137 |
-
# return response.choices[0].message.content.strip()
|
| 138 |
|
| 139 |
college = gr.ChatInterface(
|
| 140 |
college_chatbot,
|
|
@@ -164,12 +98,6 @@ summer = gr.ChatInterface(
|
|
| 164 |
description="Find opportunities that match your goals.",
|
| 165 |
textbox=gr.Textbox(placeholder="Ask Me Anything...")
|
| 166 |
)
|
| 167 |
-
# demo = gr.ChatInterface([college, summer, stress], theme = custom_theme)
|
| 168 |
-
# demo = gr.ChatInterface([college, summer, stress], type="messages", theme=gr.themes.Soft())
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
# with gr.Blocks(theme=gr.Theme.from_hub("harsh8001/skymist")) as demo:
|
| 172 |
-
# gr.TabbedInterface([college, summer, stress], ["College Information", "Summer Programs", "Stress Tips", ])
|
| 173 |
|
| 174 |
with gr.Blocks(theme=custom_theme) as demo:
|
| 175 |
gr.Image(value="Casp2.png", show_label=False, elem_id="top-image")
|
|
|
|
| 4 |
from huggingface_hub import InferenceClient
|
| 5 |
from sentence_transformers import SentenceTransformer
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
custom_theme = gr.themes.Soft(
|
| 8 |
primary_hue="pink",
|
| 9 |
secondary_hue="fuchsia",
|
|
|
|
| 41 |
max_tokens = 2100
|
| 42 |
)
|
| 43 |
return response.choices[0].message.content.strip()
|
| 44 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
def summer_chatbot(message, history):
|
| 47 |
messages = [{"role": "system", "content":"You are an expert summer program guidance advisor. Your primary mission is to give them clear, highly personalized recommendations for summer programs that perfectly align with their specific needs. It is crucial that you strictly focus ONLY on summer programs and exclude any full-time colleges or universities, as those are handled in a separate application tab. For each user, you will synthesize their answers regarding their preferred level of program competitiveness ranging from highly selective to low-competition, their geographic preferences including in-state, out-of-state, or virtual options, their current grade level, and their intended areas of study or majors. You must also account for any other necessary details they provide to narrow down the decision, such as program duration, budget, and prerequisite requirements. When delivering your recommendations, you will write in the enthusiastic, encouraging, and knowledgeable tone of a personal educational counselor. You will provide comprehensive details for each recommended summer program, including program names, focus areas, key dates, admission difficulty, cost, and a clear explanation of why the experience is a perfect fit for the student's unique profile and career aspirations. You will craft your response in bullet points, so that it's easy to remember all that information. Important to note if the user took the quiz in the college tab, because it they have not then you may ask 5 questions to help you with giving them their output. Conclude with actionable next steps to help them prepare their applications." }]
|
|
|
|
| 69 |
)
|
| 70 |
return response.choices[0].message.content.strip()
|
| 71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
college = gr.ChatInterface(
|
| 74 |
college_chatbot,
|
|
|
|
| 98 |
description="Find opportunities that match your goals.",
|
| 99 |
textbox=gr.Textbox(placeholder="Ask Me Anything...")
|
| 100 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
|
| 102 |
with gr.Blocks(theme=custom_theme) as demo:
|
| 103 |
gr.Image(value="Casp2.png", show_label=False, elem_id="top-image")
|