JeCabrera commited on
Commit
21dad47
·
verified ·
1 Parent(s): 640b9ba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -10,12 +10,11 @@ genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
10
 
11
  # Function to get response from Gemini model
12
  def get_gemini_response(input_prompt, image_data, genre, length, language, mood):
13
- model = genai.GenerativeModel('gemini-1.5-flash')
14
  if image_data:
15
  full_prompt = f"""
16
  You are a famous creative writer. Look at the image provided and create a {length} {genre} in {language}. The {genre} should be {mood}. The {genre} should be based on the image and contain realistic and emotional elements.
17
  """
18
- response = model.generate_content([full_prompt, image_data[0]])
19
  else:
20
  full_prompt = f"""
21
  You are a creative writer. Create a {length} {genre} in {language}. The {genre} should be {mood}. The {genre} should be based on the following prompt:
@@ -24,7 +23,7 @@ def get_gemini_response(input_prompt, image_data, genre, length, language, mood)
24
 
25
  Make sure it contains realistic and emotional elements.
26
  """
27
- response = model.generate_content([full_prompt])
28
 
29
  # Check if response is valid and return text
30
  if response and response.parts:
 
10
 
11
  # Function to get response from Gemini model
12
  def get_gemini_response(input_prompt, image_data, genre, length, language, mood):
 
13
  if image_data:
14
  full_prompt = f"""
15
  You are a famous creative writer. Look at the image provided and create a {length} {genre} in {language}. The {genre} should be {mood}. The {genre} should be based on the image and contain realistic and emotional elements.
16
  """
17
+ response = genai.generate_content([full_prompt, image_data[0]])
18
  else:
19
  full_prompt = f"""
20
  You are a creative writer. Create a {length} {genre} in {language}. The {genre} should be {mood}. The {genre} should be based on the following prompt:
 
23
 
24
  Make sure it contains realistic and emotional elements.
25
  """
26
+ response = genai.generate_content([full_prompt])
27
 
28
  # Check if response is valid and return text
29
  if response and response.parts: