test / app.py
Satyam-Singh's picture
Update app.py
45b704b verified
raw
history blame contribute delete
967 Bytes
import google.generativeai as genai
import gradio as gr
import os
import random
genai.configure(api_key=os.getenv("KEY"))
generation_config = {
"temperature": 0.9,
"top_p": 1,
"top_k": 1,
"max_output_tokens": 4096,
}
model = genai.GenerativeModel(model_name="gemini-pro",generation_config=generation_config)
def generate(prompt):
convo = model.start_chat(history=[])
convo.send_message(prompt)
return convo.last.text
llava=gr.ChatInterface(
fn=generate,
chatbot=gr.Chatbot(show_label=False, avatar_images=(random.choice(['1.png','2,png','3.png','4.png','5.png']), 'llava-logo.svg'), show_share_button=False, show_copy_button=True, likeable=True, layout="panel",bubble_full_width=False),
title="LLaVa-2",
description="This Is Official Demo Of ```LLaVa-2```. ```History/context``` memory does not work in this demo",
concurrency_limit=20,#layout="vertical",bubble_full_width=False
)
llava.launch(share=True,show_api=False)