Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -164,15 +164,21 @@ generation_config = {
|
|
164 |
"response_mime_type": "text/plain",
|
165 |
}
|
166 |
|
167 |
-
|
168 |
-
#model_name="gemini-1.5-flash",
|
169 |
model_name="gemini-1.5-pro",
|
170 |
generation_config=generation_config,
|
171 |
# safety_settings = Adjust safety settings
|
172 |
# See https://ai.google.dev/gemini-api/docs/safety-settings
|
173 |
)
|
174 |
|
175 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
global model
|
177 |
chat_session = model.start_chat(
|
178 |
history=[
|
@@ -184,18 +190,31 @@ def geminiinferenceinstance(text):
|
|
184 |
|
185 |
return response.text #print(response.text)
|
186 |
|
187 |
-
def
|
188 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
|
190 |
return Finaloutput
|
191 |
|
192 |
-
def generateconfig(text)
|
193 |
-
Finaloutput =
|
194 |
|
195 |
return Finaloutput
|
196 |
|
197 |
-
def debugsuggestions(text)
|
198 |
-
Finaloutput =
|
199 |
|
200 |
return Finaloutput
|
201 |
|
@@ -463,7 +482,8 @@ with gr.Blocks() as geminiapidemo:
|
|
463 |
with gr.Accordion("Gemini Config", open=False):
|
464 |
gr.Interface(brainstormconsiderations, inputs=["text"], outputs=["text"], description="some considerations for generated config")
|
465 |
gr.Interface(generateconfig, inputs=["text"], outputs=["text"], description=" generated config")
|
466 |
-
gr.Interface(debugsuggestions, inputs=["text"], outputs=["text"], description="debug generated config")
|
|
|
467 |
with gr.Tab("Manual - Config With Assets"):
|
468 |
gr.HTML("Placeholder as not complete yet (3D not supported, and time (esp need for audio)")
|
469 |
with gr.Row():
|
|
|
164 |
"response_mime_type": "text/plain",
|
165 |
}
|
166 |
|
167 |
+
modelpro = genai.GenerativeModel(
|
|
|
168 |
model_name="gemini-1.5-pro",
|
169 |
generation_config=generation_config,
|
170 |
# safety_settings = Adjust safety settings
|
171 |
# See https://ai.google.dev/gemini-api/docs/safety-settings
|
172 |
)
|
173 |
|
174 |
+
modelflash = genai.GenerativeModel(
|
175 |
+
model_name="gemini-1.5-flash",
|
176 |
+
generation_config=generation_config,
|
177 |
+
# safety_settings = Adjust safety settings
|
178 |
+
# See https://ai.google.dev/gemini-api/docs/safety-settings
|
179 |
+
)
|
180 |
+
|
181 |
+
def geminiproinferenceinstance(text):
|
182 |
global model
|
183 |
chat_session = model.start_chat(
|
184 |
history=[
|
|
|
190 |
|
191 |
return response.text #print(response.text)
|
192 |
|
193 |
+
def geminiflashinferenceinstance(text):
|
194 |
+
global modelflash
|
195 |
+
chat_session = model.start_chat(
|
196 |
+
history=[
|
197 |
+
]
|
198 |
+
)
|
199 |
+
|
200 |
+
#response = chat_session.send_message(f"NBNB property name must be enclosed in double quotes. Use this as inspiration to make a pirate story aka keep same format to work with an existing app: /n/n{configcomptestexample} ")
|
201 |
+
response = chat_session.send_message(text)
|
202 |
+
|
203 |
+
return response.text #print(response.text
|
204 |
+
|
205 |
+
|
206 |
+
def brainstormconsiderations(text):
|
207 |
+
Finaloutput = geminiproinferenceinstance(text)
|
208 |
|
209 |
return Finaloutput
|
210 |
|
211 |
+
def generateconfig(text):
|
212 |
+
Finaloutput = geminiproinferenceinstance(text)
|
213 |
|
214 |
return Finaloutput
|
215 |
|
216 |
+
def debugsuggestions(text):
|
217 |
+
Finaloutput = geminiproinferenceinstance(text)
|
218 |
|
219 |
return Finaloutput
|
220 |
|
|
|
482 |
with gr.Accordion("Gemini Config", open=False):
|
483 |
gr.Interface(brainstormconsiderations, inputs=["text"], outputs=["text"], description="some considerations for generated config")
|
484 |
gr.Interface(generateconfig, inputs=["text"], outputs=["text"], description=" generated config")
|
485 |
+
gr.Interface(debugsuggestions, inputs=["text"], outputs=["text"], description="debug generated config ")
|
486 |
+
gr.Interface(geminiflashinferenceinstance, inputs=["text"], outputs=["text"], description="flash test")
|
487 |
with gr.Tab("Manual - Config With Assets"):
|
488 |
gr.HTML("Placeholder as not complete yet (3D not supported, and time (esp need for audio)")
|
489 |
with gr.Row():
|