Spaces:
Running
Running
Satyam-Singh
commited on
Commit
•
4e07148
1
Parent(s):
04f332d
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import google.generativeai as genai
|
2 |
+
import gradio as gr
|
3 |
+
import os
|
4 |
+
|
5 |
+
genai.configure(api_key=os.getenv("GOOGLE_PALM_KEY"))
|
6 |
+
|
7 |
+
def generate(prompt, history):
|
8 |
+
response = genai.chat(
|
9 |
+
messages=prompt)
|
10 |
+
|
11 |
+
return response.last
|
12 |
+
|
13 |
+
|
14 |
+
gr.ChatInterface(
|
15 |
+
fn=generate,
|
16 |
+
chatbot=gr.Chatbot(show_label=False, avatar_images=(None, 'palm-logo.png'), show_share_button=False, show_copy_button=True, likeable=True, layout="panel"),
|
17 |
+
title="PaLM-2",
|
18 |
+
description="This Is Official Demo Of ```PaLM-2``` Based On ```Google API```. ```History/context``` memory does not work in this demo",
|
19 |
+
concurrency_limit=20,
|
20 |
+
).launch(show_api=False)
|