Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -14,7 +14,6 @@ from dotenv import load_dotenv
|
|
14 |
load_dotenv()
|
15 |
|
16 |
GEMINI_API_KEY = os.getenv("GEMINI_API_KEY")
|
17 |
-
genai.configure(api_key=GEMINI_API_KEY)
|
18 |
|
19 |
TITLE = """<h1 align="center">🎮Chat with Gemini 1.5🔥 -- Beta Preview</h1>"""
|
20 |
NOTICE = """
|
@@ -160,57 +159,64 @@ bot_inputs = [
|
|
160 |
chatbot_component
|
161 |
]
|
162 |
|
163 |
-
with gr.Blocks() as demo:
|
164 |
-
gr.
|
165 |
-
|
166 |
-
gr.Markdown(NOTICE)
|
167 |
-
gr.Markdown(ABOUT)
|
168 |
-
gr.Markdown(ERRORS)
|
169 |
-
gr.Markdown(FUTURE_IMPLEMENTATIONS)
|
170 |
-
with gr.Column():
|
171 |
-
google_key_component.render()
|
172 |
with gr.Row():
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
with gr.
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
load_dotenv()
|
15 |
|
16 |
GEMINI_API_KEY = os.getenv("GEMINI_API_KEY")
|
|
|
17 |
|
18 |
TITLE = """<h1 align="center">🎮Chat with Gemini 1.5🔥 -- Beta Preview</h1>"""
|
19 |
NOTICE = """
|
|
|
159 |
chatbot_component
|
160 |
]
|
161 |
|
162 |
+
with gr.Blocks(theme = gr.Themes.Soft()) as demo:
|
163 |
+
with gr.Tab("Chat with Gemini 1.5 Flash"):
|
164 |
+
gr.HTML(TITLE)
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
with gr.Row():
|
166 |
+
gr.Markdown(NOTICE)
|
167 |
+
gr.Markdown(ABOUT)
|
168 |
+
gr.Markdown(ERRORS)
|
169 |
+
gr.Markdown(FUTURE_IMPLEMENTATIONS)
|
170 |
+
with gr.Column():
|
171 |
+
google_key_component.render()
|
172 |
+
with gr.Row():
|
173 |
+
image_prompt_component.render()
|
174 |
+
chatbot_component.render()
|
175 |
+
text_prompt_component.render()
|
176 |
+
run_button_component.render()
|
177 |
+
with gr.Accordion("Parameters", open=False):
|
178 |
+
temperature_component.render()
|
179 |
+
max_output_tokens_component.render()
|
180 |
+
stop_sequences_component.render()
|
181 |
+
with gr.Accordion("Advanced", open=False):
|
182 |
+
top_k_component.render()
|
183 |
+
top_p_component.render()
|
184 |
+
|
185 |
+
run_button_component.click(
|
186 |
+
fn = user,
|
187 |
+
inputs = user_inputs,
|
188 |
+
outputs = [
|
189 |
+
text_prompt_component,
|
190 |
+
chatbot_component
|
191 |
+
],
|
192 |
+
queue = False
|
193 |
+
).then(
|
194 |
+
fn = bot,
|
195 |
+
inputs = bot_inputs,
|
196 |
+
outputs = [
|
197 |
+
chatbot_component
|
198 |
+
]
|
199 |
+
)
|
200 |
+
text_prompt_component.submit(
|
201 |
+
fn = user,
|
202 |
+
inputs = user_inputs,
|
203 |
+
outputs = [
|
204 |
+
text_prompt_component,
|
205 |
+
chatbot_component
|
206 |
+
],
|
207 |
+
queue = False
|
208 |
+
).then(
|
209 |
+
fn = bot,
|
210 |
+
inputs = bot_inputs,
|
211 |
+
outputs = [
|
212 |
+
chatbot_component
|
213 |
+
]
|
214 |
+
)
|
215 |
+
with gr.Tab("Chat with Gemini Gemma 2"):
|
216 |
+
gr.HTML(
|
217 |
+
"""
|
218 |
+
<h1 align="center">Still in development</h1>
|
219 |
+
"""
|
220 |
+
)
|
221 |
+
|
222 |
+
demo.queu().launch(debug = True, show_error = True)
|