burak commited on
Commit
c3de96c
β€’
1 Parent(s): dfc3279

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -11,7 +11,7 @@ print("google-generativeai:", genai.__version__)
11
 
12
  GOOGLE_API_KEY = os.environ.get("GOOGLE_API_KEY")
13
 
14
- TITLE = """<h1 align="center">πŸ‹οΈ Online Personal TrAIner πŸ’ͺ</h1>"""
15
  SUBTITLE = """<h2 align="center">Play with Gemini Text and Vision Model API πŸ–‡οΈ</h2>"""
16
  DUPLICATE = """
17
  <div style="text-align: center; display: flex; justify-content: center; align-items: center;">
@@ -43,8 +43,7 @@ def preprocess_stop_sequences(stop_sequences: str) -> Optional[List[str]]:
43
  return [sequence.strip() for sequence in stop_sequences.split(",")]
44
 
45
  def user(text_prompt: str, chatbot: List[Tuple[str, str]]):
46
- combined_prompt = text_prompt + "\n" + Prompt
47
- return "", chatbot + [[combined_prompt, None]]
48
 
49
  def bot(
50
  google_key: str,
@@ -64,7 +63,8 @@ def bot(
64
  "GOOGLE_API_KEY is not set. "
65
  "Please follow the instructions in the README to set it up.")
66
 
67
- text_prompt = chatbot[-1][0]
 
68
 
69
  genai.configure(api_key=google_key)
70
  generation_config = genai.types.GenerationConfig(
@@ -87,7 +87,7 @@ def bot(
87
  raise ValueError(video_file.state.name)
88
 
89
  response = model.generate_content(
90
- contents=[video_file, text_prompt],
91
  stream=True,
92
  generation_config=generation_config,
93
  request_options={"timeout": 600})
@@ -95,7 +95,7 @@ def bot(
95
  else:
96
  model = genai.GenerativeModel(model_name)
97
  response = model.generate_content(
98
- text_prompt,
99
  stream=True,
100
  generation_config=generation_config)
101
  response.resolve()
 
11
 
12
  GOOGLE_API_KEY = os.environ.get("GOOGLE_API_KEY")
13
 
14
+ TITLE = """<h1 align="center">πŸ•ΉοΈ Google Gemini Playground πŸ”₯</h1>"""
15
  SUBTITLE = """<h2 align="center">Play with Gemini Text and Vision Model API πŸ–‡οΈ</h2>"""
16
  DUPLICATE = """
17
  <div style="text-align: center; display: flex; justify-content: center; align-items: center;">
 
43
  return [sequence.strip() for sequence in stop_sequences.split(",")]
44
 
45
  def user(text_prompt: str, chatbot: List[Tuple[str, str]]):
46
+ return "", chatbot + [[text_prompt, None]]
 
47
 
48
  def bot(
49
  google_key: str,
 
63
  "GOOGLE_API_KEY is not set. "
64
  "Please follow the instructions in the README to set it up.")
65
 
66
+ user_input = chatbot[-1][0]
67
+ combined_prompt = user_input + "\n" + Prompt
68
 
69
  genai.configure(api_key=google_key)
70
  generation_config = genai.types.GenerationConfig(
 
87
  raise ValueError(video_file.state.name)
88
 
89
  response = model.generate_content(
90
+ contents=[video_file, combined_prompt],
91
  stream=True,
92
  generation_config=generation_config,
93
  request_options={"timeout": 600})
 
95
  else:
96
  model = genai.GenerativeModel(model_name)
97
  response = model.generate_content(
98
+ combined_prompt,
99
  stream=True,
100
  generation_config=generation_config)
101
  response.resolve()