AjithReddy commited on
Commit
28d3222
·
verified ·
1 Parent(s): a78918d

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -33
app.py DELETED
@@ -1,33 +0,0 @@
1
- import os
2
- from google import genai
3
- from google.genai import types
4
- import gradio as gr
5
-
6
- client=genai.Client(api_key = .getenv('GEMINI_API_KEY'))
7
- personalities = {
8
- "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.",
9
- "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."
10
- }
11
- def study_assistant(question,persona):
12
- system_prompt = personalities[persona]
13
- response = client.models.generate_content(
14
- model="gemini-2.5-flash",
15
- config= types.GenerateContentConfig(
16
- system_instruction = system_prompt,
17
- temperature=0.4,
18
- max_output_tokens=1000
19
- ),
20
- contents = question
21
- )
22
- return response.text
23
- demo = gr.Interface(
24
- fn=study_assistant,
25
- inputs=[
26
- gr.Textbox(label="question", lines=4, placeholder="Ask a Question.."),
27
- gr.Dropdown(choices=list(personalities.keys()), value="Friendly", label="personality")
28
- ],
29
- outputs=gr.Textbox(label="Explanation", lines=10),
30
- title="Study Assistant",
31
- description="Ask a question and get an answer from your AI study assistant with a chosen personality."
32
- )
33
- demo.launch(debug=True)