Spaces:
Running
Running
Added Gemini avatar
Browse files
app.py
CHANGED
|
@@ -4,6 +4,8 @@ import google.generativeai as genai
|
|
| 4 |
import gradio as gr
|
| 5 |
from PIL import Image
|
| 6 |
|
|
|
|
|
|
|
| 7 |
TITLE = """<h1 align="center">Gemini Playground 💬</h1>"""
|
| 8 |
SUBTITLE = """<h2 align="center">Play with Gemini Pro and Gemini Pro Vision API</h2>"""
|
| 9 |
DUPLICATE = """
|
|
@@ -16,8 +18,10 @@ DUPLICATE = """
|
|
| 16 |
</span>
|
| 17 |
</div>
|
| 18 |
"""
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
|
| 21 |
|
| 22 |
|
| 23 |
def preprocess_stop_sequences(stop_sequences: str) -> Optional[List[str]]:
|
|
@@ -78,7 +82,12 @@ google_key_component = gr.Textbox(
|
|
| 78 |
)
|
| 79 |
|
| 80 |
image_prompt_component = gr.Image(type="pil", label="Image", scale=1)
|
| 81 |
-
chatbot_component = gr.Chatbot(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
text_prompt_component = gr.Textbox(
|
| 83 |
placeholder="Hi there!",
|
| 84 |
label="Ask me anything and press Enter"
|
|
|
|
| 4 |
import gradio as gr
|
| 5 |
from PIL import Image
|
| 6 |
|
| 7 |
+
print("google-generativeai:", genai.__version__)
|
| 8 |
+
|
| 9 |
TITLE = """<h1 align="center">Gemini Playground 💬</h1>"""
|
| 10 |
SUBTITLE = """<h2 align="center">Play with Gemini Pro and Gemini Pro Vision API</h2>"""
|
| 11 |
DUPLICATE = """
|
|
|
|
| 18 |
</span>
|
| 19 |
</div>
|
| 20 |
"""
|
| 21 |
+
AVATAR_IMAGES = (
|
| 22 |
+
None,
|
| 23 |
+
"https://media.roboflow.com/spaces/gemini-icon.png"
|
| 24 |
+
)
|
| 25 |
|
| 26 |
|
| 27 |
def preprocess_stop_sequences(stop_sequences: str) -> Optional[List[str]]:
|
|
|
|
| 82 |
)
|
| 83 |
|
| 84 |
image_prompt_component = gr.Image(type="pil", label="Image", scale=1)
|
| 85 |
+
chatbot_component = gr.Chatbot(
|
| 86 |
+
label='Gemini',
|
| 87 |
+
bubble_full_width=False,
|
| 88 |
+
avatar_images=AVATAR_IMAGES,
|
| 89 |
+
scale=2
|
| 90 |
+
)
|
| 91 |
text_prompt_component = gr.Textbox(
|
| 92 |
placeholder="Hi there!",
|
| 93 |
label="Ask me anything and press Enter"
|