marwanto606 commited on
Commit
1a49c6a
·
verified ·
1 Parent(s): f2efccd

Update app.py

Browse files

- add link my lovable tool

Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -10,16 +10,17 @@ genai.configure(api_key=secret_key)
10
  # Fungsi untuk menghasilkan prompt dari gambar
11
  def get_gemini_response(image):
12
  model = genai.GenerativeModel('gemini-2.0-flash')
13
- input = '''You are a prompt generator. You will get an image.
14
- Your work is to write a prompt such that an image generator model would create most identical picture
15
- as the image given to you'''
16
- response = model.generate_content([input, image])
17
  return response.text
18
 
19
  # Konfigurasi halaman
20
  st.set_page_config(page_title="Prompt Generation from Image", layout="wide")
21
  st.title("🖼️ Prompt Generator from Image")
22
 
 
 
 
23
  # Dua kolom layout
24
  col1, col2 = st.columns(2)
25
 
@@ -30,7 +31,7 @@ with col1:
30
  type=["jpg", "jpeg", "png", "webp"],
31
  label_visibility="collapsed"
32
  )
33
-
34
  if uploaded_file is not None:
35
  image = Image.open(uploaded_file)
36
  st.image(image, caption="Uploaded Image", use_column_width=True)
@@ -43,7 +44,7 @@ with col2:
43
  if st.button("✨ Generate Prompt"):
44
  with st.spinner("Generating prompt..."):
45
  prompt = get_gemini_response(image)
46
- st.code(prompt, language="markdown")
47
- st.success("Prompt generated. Use the copy button on the top-right of the code box.")
48
  else:
49
- st.info("Please upload an image to generate a prompt.")
 
10
  # Fungsi untuk menghasilkan prompt dari gambar
11
  def get_gemini_response(image):
12
  model = genai.GenerativeModel('gemini-2.0-flash')
13
+ input = '''You are a prompt generator. You will get an image. Your work is to write a prompt such that an image generator model would create most identical picture as the image given to you'''
14
+ response = model.generate_content([input, image])
 
 
15
  return response.text
16
 
17
  # Konfigurasi halaman
18
  st.set_page_config(page_title="Prompt Generation from Image", layout="wide")
19
  st.title("🖼️ Prompt Generator from Image")
20
 
21
+ # Menambahkan link ke tool sejenis
22
+ st.markdown("> Please try my same tool at : https://imgkey.lovable.app")
23
+
24
  # Dua kolom layout
25
  col1, col2 = st.columns(2)
26
 
 
31
  type=["jpg", "jpeg", "png", "webp"],
32
  label_visibility="collapsed"
33
  )
34
+
35
  if uploaded_file is not None:
36
  image = Image.open(uploaded_file)
37
  st.image(image, caption="Uploaded Image", use_column_width=True)
 
44
  if st.button("✨ Generate Prompt"):
45
  with st.spinner("Generating prompt..."):
46
  prompt = get_gemini_response(image)
47
+ st.code(prompt, language="markdown")
48
+ st.success("Prompt generated. Use the copy button on the top-right of the code box.")
49
  else:
50
+ st.info("Please upload an image to generate a prompt.")