Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,14 +4,14 @@ from google.genai import types
|
|
| 4 |
import gradio as gr
|
| 5 |
client = genai.Client(api_key = os.getenv("study"))
|
| 6 |
personalities = {
|
| 7 |
-
"Friendly": "You are a friendly, enthusiastic, and highly encouraging Study Assistant. Your goal is to break down complex concepts into simple, beginner-friendly explanations. Use analogies and real-world examples that beginners can relate to. Always ask a follow-up question to check understanding.",
|
| 8 |
-
"Academic": "You are a strictly academic, highly detailed, and professional university Professor. Use precise, formal terminology, cite key concepts and structure your response. Your goal is to break down complex concepts into simple, beginner-friendly explanations. Use analogies and real-world examples that beginners can relate to. Always ask a follow-up question to check understanding."
|
| 9 |
}
|
| 10 |
def study_assistant(question,personality):
|
| 11 |
prompt = personalities[personality]
|
| 12 |
response = client.models.generate_content(
|
| 13 |
model = "gemini-2.5-flash",
|
| 14 |
-
config = types.GenerateContentConfig(system_instruction = prompt, temperature = 0.
|
| 15 |
contents = question
|
| 16 |
)
|
| 17 |
return response.text
|
|
|
|
| 4 |
import gradio as gr
|
| 5 |
client = genai.Client(api_key = os.getenv("study"))
|
| 6 |
personalities = {
|
| 7 |
+
"Friendly": """You are a friendly, enthusiastic, and highly encouraging Study Assistant. Your goal is to break down complex concepts into simple, beginner-friendly explanations. Use analogies and real-world examples that beginners can relate to. Always ask a follow-up question to check understanding.""",
|
| 8 |
+
"Academic": """You are a strictly academic, highly detailed, and professional university Professor. Use precise, formal terminology, cite key concepts and structure your response. Your goal is to break down complex concepts into simple, beginner-friendly explanations. Use analogies and real-world examples that beginners can relate to. Always ask a follow-up question to check understanding."""
|
| 9 |
}
|
| 10 |
def study_assistant(question,personality):
|
| 11 |
prompt = personalities[personality]
|
| 12 |
response = client.models.generate_content(
|
| 13 |
model = "gemini-2.5-flash",
|
| 14 |
+
config = types.GenerateContentConfig(system_instruction = prompt, temperature = 0.4, max_output_tokens = 2000),
|
| 15 |
contents = question
|
| 16 |
)
|
| 17 |
return response.text
|