Spaces:
Runtime error
Runtime error
Update pages/11_Gemini-Cyclic.py
Browse files- pages/11_Gemini-Cyclic.py +13 -1
pages/11_Gemini-Cyclic.py
CHANGED
|
@@ -2,6 +2,7 @@ import streamlit as st
|
|
| 2 |
import uuid
|
| 3 |
import google.generativeai as genai
|
| 4 |
from io import BytesIO
|
|
|
|
| 5 |
|
| 6 |
# Define a dictionary of system prompts mapped to numbers
|
| 7 |
system_prompts = {
|
|
@@ -12,6 +13,14 @@ system_prompts = {
|
|
| 12 |
'5': "AI Fitness Coach Prompt: Offer fitness and health advice.",
|
| 13 |
}
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
# Set your API key
|
| 16 |
api_key = "AIzaSyC70u1sN87IkoxOoIj4XCAPw97ae2LZwNM"
|
| 17 |
|
|
@@ -65,6 +74,9 @@ def process_input_sequence():
|
|
| 65 |
input_sequence = st.session_state.input_sequence
|
| 66 |
for digit in input_sequence:
|
| 67 |
system_prompt = system_prompts.get(digit, "Default system prompt")
|
|
|
|
|
|
|
|
|
|
| 68 |
send_message(system_prompt)
|
| 69 |
|
| 70 |
# Send message function with system prompt
|
|
@@ -104,4 +116,4 @@ input_sequence = st.text_input("Enter your input sequence (e.g., 12345):", value
|
|
| 104 |
send_button = st.button("Send", on_click=process_input_sequence)
|
| 105 |
|
| 106 |
# Clear conversation button
|
| 107 |
-
clear_button = st.button("Clear Conversation", on_click=clear_conversation)
|
|
|
|
| 2 |
import uuid
|
| 3 |
import google.generativeai as genai
|
| 4 |
from io import BytesIO
|
| 5 |
+
from PIL import Image
|
| 6 |
|
| 7 |
# Define a dictionary of system prompts mapped to numbers
|
| 8 |
system_prompts = {
|
|
|
|
| 13 |
'5': "AI Fitness Coach Prompt: Offer fitness and health advice.",
|
| 14 |
}
|
| 15 |
|
| 16 |
+
placeholder_images = {
|
| 17 |
+
'1': Image.open('data/image1.jpg'),
|
| 18 |
+
'2': Image.open('data/image2.jpg'),
|
| 19 |
+
'3': Image.open('data/image3.jpg'),
|
| 20 |
+
'4': Image.open('data/image4.jpg'),
|
| 21 |
+
'5': Image.open('data/image5.jpg')
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
# Set your API key
|
| 25 |
api_key = "AIzaSyC70u1sN87IkoxOoIj4XCAPw97ae2LZwNM"
|
| 26 |
|
|
|
|
| 74 |
input_sequence = st.session_state.input_sequence
|
| 75 |
for digit in input_sequence:
|
| 76 |
system_prompt = system_prompts.get(digit, "Default system prompt")
|
| 77 |
+
# Display the corresponding image for the current digit
|
| 78 |
+
if digit in placeholder_images:
|
| 79 |
+
st.image(placeholder_images[digit], caption=f"Image for Prompt {digit}")
|
| 80 |
send_message(system_prompt)
|
| 81 |
|
| 82 |
# Send message function with system prompt
|
|
|
|
| 116 |
send_button = st.button("Send", on_click=process_input_sequence)
|
| 117 |
|
| 118 |
# Clear conversation button
|
| 119 |
+
clear_button = st.button("Clear Conversation", on_click=clear_conversation)
|