Artples commited on
Commit
7c1f4c4
·
verified ·
1 Parent(s): 771ccc7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -29,7 +29,7 @@ safety_settings = [
29
  MODEL_NAME = "gemini-2.0-flash"
30
 
31
  # Framework selection (e.g., Tailwind, Bootstrap, etc.)
32
- framework = "Regular CSS use flex grid etc" # Change this to "Bootstrap" or any other framework as needed
33
 
34
  # Create the model
35
  model = genai.GenerativeModel(
@@ -74,19 +74,19 @@ def main():
74
  # Generate UI description
75
  if st.button("Code UI"):
76
  st.write("🧑‍💻 Looking at your UI...")
77
- prompt = "Describe this UI in accurate details. When you reference a UI element put its name and bounding box in the format: [object name (y_min, x_min, y_max, x_max)]. Also Describe the color of the elements."
78
  description = send_message_to_model(prompt, temp_image_path)
79
  st.write(description)
80
 
81
  # Refine the description
82
  st.write("🔍 Refining description with visual comparison...")
83
- refine_prompt = f"Compare the described UI elements with the provided image and identify any missing elements or inaccuracies. Also Describe the color of the elements. Provide a refined and accurate description of the UI elements based on this comparison. Here is the initial description: {description}"
84
  refined_description = send_message_to_model(refine_prompt, temp_image_path)
85
  st.write(refined_description)
86
 
87
  # Generate HTML
88
  st.write("🛠️ Generating website...")
89
- html_prompt = f"Create an HTML file based on the following UI description, using the UI elements described in the previous response. Include {framework} CSS within the HTML file to style the elements. Make sure the colors used are the same as the original UI. The UI needs to be responsive and mobile-first, matching the original UI as closely as possible. Do not include any explanations or comments. Avoid using ```html. and ``` at the end. ONLY return the HTML code with inline CSS. Here is the refined description: {refined_description}"
90
  initial_html = send_message_to_model(html_prompt, temp_image_path)
91
  st.code(initial_html, language='html')
92
 
 
29
  MODEL_NAME = "gemini-2.0-flash"
30
 
31
  # Framework selection (e.g., Tailwind, Bootstrap, etc.)
32
+ framework = "Tailwind CSS with the Browser CDN, with the script for it gotten from https://priority.cdn.leunos.com/tailwind.js, so use Tailwind" # Change this to "Bootstrap" or any other framework as needed
33
 
34
  # Create the model
35
  model = genai.GenerativeModel(
 
74
  # Generate UI description
75
  if st.button("Code UI"):
76
  st.write("🧑‍💻 Looking at your UI...")
77
+ prompt = "Describe this UI in accurate details. When you reference a UI element put its name and bounding box in the format: [object name (y_min, x_min, y_max, x_max)]. Also Describe the color of the elements. Be very precise and formulate as much information as you can"
78
  description = send_message_to_model(prompt, temp_image_path)
79
  st.write(description)
80
 
81
  # Refine the description
82
  st.write("🔍 Refining description with visual comparison...")
83
+ refine_prompt = f"Compare the described UI elements with the provided image and identify any missing elements or inaccuracies. Be very precise and concise, bring a very good and lenghty description of the website seen in the image. Also Describe the color of the elements. Provide a refined and accurate description of the UI elements based on this comparison. Here is the initial description: {description}"
84
  refined_description = send_message_to_model(refine_prompt, temp_image_path)
85
  st.write(refined_description)
86
 
87
  # Generate HTML
88
  st.write("🛠️ Generating website...")
89
+ html_prompt = f"Create an HTML file based on the following UI description, using the UI elements described in the previous response. Include {framework} CSS within the HTML file to style the elements. Make sure the colors used are the same as the original UI. The UI needs to be responsive and mobile-first, matching the original UI as closely as possible. Do not include any explanations or comments. Avoid using ```html. and ``` at the end. ONLY return the HTML code with inline CSS. Here is the refined description. Also think a long time on how the code could be set up for the copy of such website andthink of steps that are needed for that: {refined_description}"
90
  initial_html = send_message_to_model(html_prompt, temp_image_path)
91
  st.code(initial_html, language='html')
92