Spaces:
Sleeping
Sleeping
prithivMLmods
commited on
Commit
•
8312a74
1
Parent(s):
6603185
Update app.py
Browse files
app.py
CHANGED
@@ -14,7 +14,7 @@ footer {
|
|
14 |
|
15 |
load_dotenv()
|
16 |
|
17 |
-
GEMINI_API_KEY = "AIzaSyBRkv6TCfyZtT5Q6H6ur2W8KSNt9ksbeDI"
|
18 |
|
19 |
genai.configure(api_key=GEMINI_API_KEY)
|
20 |
|
@@ -39,9 +39,7 @@ mood_prompts = {
|
|
39 |
}
|
40 |
|
41 |
def generate_response(user_input, chat_history, mood):
|
42 |
-
"""Generates a response based on user input, chat history, and mood."""
|
43 |
|
44 |
-
# Update system content with the full character description and mood
|
45 |
updated_system_content = f"{mood_prompts[mood]}"
|
46 |
|
47 |
model = genai.GenerativeModel(
|
@@ -76,15 +74,13 @@ def generate_response(user_input, chat_history, mood):
|
|
76 |
|
77 |
# Build the Gradio interface
|
78 |
with gr.Blocks(css=css, theme="bethecloud/storj_theme") as iface:
|
79 |
-
|
80 |
-
chat_input = gr.Textbox(lines=2, label="
|
81 |
-
chat_history_state = gr.State([])
|
82 |
response_output = gr.Textbox(label="Response")
|
83 |
|
84 |
-
|
85 |
-
mood_selector = gr.Dropdown(choices=list(mood_prompts.keys()), value="Professional", label="Select Mood")
|
86 |
|
87 |
-
# Define the layout and components
|
88 |
generate_button = gr.Button("Generate Response")
|
89 |
generate_button.click(
|
90 |
fn=generate_response,
|
|
|
14 |
|
15 |
load_dotenv()
|
16 |
|
17 |
+
GEMINI_API_KEY = "AIzaSyBRkv6TCfyZtT5Q6H6ur2W8KSNt9ksbeDI"
|
18 |
|
19 |
genai.configure(api_key=GEMINI_API_KEY)
|
20 |
|
|
|
39 |
}
|
40 |
|
41 |
def generate_response(user_input, chat_history, mood):
|
|
|
42 |
|
|
|
43 |
updated_system_content = f"{mood_prompts[mood]}"
|
44 |
|
45 |
model = genai.GenerativeModel(
|
|
|
74 |
|
75 |
# Build the Gradio interface
|
76 |
with gr.Blocks(css=css, theme="bethecloud/storj_theme") as iface:
|
77 |
+
|
78 |
+
chat_input = gr.Textbox(lines=2, label="Chatbot", placeholder="Enter your message here...")
|
79 |
+
chat_history_state = gr.State([])
|
80 |
response_output = gr.Textbox(label="Response")
|
81 |
|
82 |
+
mood_selector = gr.Radio(choices=list(mood_prompts.keys()), value="Professional", label="Select Mood")
|
|
|
83 |
|
|
|
84 |
generate_button = gr.Button("Generate Response")
|
85 |
generate_button.click(
|
86 |
fn=generate_response,
|