akhaliq HF staff commited on
Commit
a21891c
1 Parent(s): 4c02c40

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -31,12 +31,18 @@ def generate_gradio_app(image):
31
  img_str = base64.b64encode(buffered.getvalue()).decode()
32
 
33
  # Prepare the messages for the API call
 
 
 
 
 
 
 
 
 
34
  messages = [
35
- {"role": "system", "content": "You are an AI assistant that can analyze wireframe images and generate Gradio code based on their content."},
36
- {"role": "user", "content": [
37
- {"type": "image_url", "image_url": f"data:image/png;base64,{img_str}"},
38
- {"type": "text", "text": "Analyze this wireframe image and generate Python code using Gradio that could recreate the main elements seen in the image. Use Gradio components that best represent the UI elements in the wireframe."}
39
- ]}
40
  ]
41
 
42
  # Make the API call
 
31
  img_str = base64.b64encode(buffered.getvalue()).decode()
32
 
33
  # Prepare the messages for the API call
34
+ system_message = "You are an AI assistant that can analyze wireframe images and generate Gradio code based on their content."
35
+ user_message = f"""
36
+ <image>
37
+ data:image/png;base64,{img_str}
38
+ </image>
39
+
40
+ Analyze this wireframe image and generate Python code using Gradio that could recreate the main elements seen in the image. Use Gradio components that best represent the UI elements in the wireframe.
41
+ """
42
+
43
  messages = [
44
+ {"role": "system", "content": system_message},
45
+ {"role": "user", "content": user_message}
 
 
 
46
  ]
47
 
48
  # Make the API call