Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -36,6 +36,9 @@ def generate_gradio_app(api_key, image):
|
|
36 |
if not api_key:
|
37 |
return "Error: API key not provided. Please enter your Together API key."
|
38 |
|
|
|
|
|
|
|
39 |
try:
|
40 |
initialize_client(api_key)
|
41 |
|
@@ -53,14 +56,15 @@ def generate_gradio_app(api_key, image):
|
|
53 |
8. Provide a runnable Gradio application focusing on the most important aspects of the UI.
|
54 |
9. Keep the code concise, aiming for no more than 2000 tokens.
|
55 |
|
56 |
-
Please generate the Gradio code based on the provided image, focusing on the most crucial elements to fit within the token limit.
|
57 |
-
|
58 |
-
[IMAGE]data:image/jpeg;base64,{encoded_image}[/IMAGE]"""
|
59 |
|
60 |
messages = [
|
61 |
{
|
62 |
"role": "user",
|
63 |
-
"content":
|
|
|
|
|
|
|
64 |
}
|
65 |
]
|
66 |
|
|
|
36 |
if not api_key:
|
37 |
return "Error: API key not provided. Please enter your Together API key."
|
38 |
|
39 |
+
if image is None:
|
40 |
+
return "Error: No image provided. Please upload an image."
|
41 |
+
|
42 |
try:
|
43 |
initialize_client(api_key)
|
44 |
|
|
|
56 |
8. Provide a runnable Gradio application focusing on the most important aspects of the UI.
|
57 |
9. Keep the code concise, aiming for no more than 2000 tokens.
|
58 |
|
59 |
+
Please generate the Gradio code based on the provided image, focusing on the most crucial elements to fit within the token limit."""
|
|
|
|
|
60 |
|
61 |
messages = [
|
62 |
{
|
63 |
"role": "user",
|
64 |
+
"content": [
|
65 |
+
{"type": "text", "text": prompt},
|
66 |
+
{"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{encoded_image}"}}
|
67 |
+
]
|
68 |
}
|
69 |
]
|
70 |
|