Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -27,15 +27,17 @@ def generate_testing_instructions(images, context):
|
|
27 |
|
28 |
base64_images = encode_images(images)
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
39 |
|
40 |
- **Description**: A brief explanation of the feature being tested.
|
41 |
- **Pre-conditions**: The required setup or state of the app before beginning the test.
|
@@ -51,24 +53,28 @@ Please demonstrate your approach using the following features of a mobile app:
|
|
51 |
5. **Offers**: Showcases available promotions and discounts.
|
52 |
6. **Filters**: Options to filter buses by time, price, or other preferences.
|
53 |
7. **Bus Information**: Provides details about the selected bus, including amenities, photos, and reviews.
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
|
|
|
|
67 |
return completion.choices[0].message.content
|
68 |
|
69 |
-
# Create the Gradio interface
|
70 |
with gr.Blocks() as demo:
|
71 |
-
gr.Markdown("## App Testing Instructions Generator")
|
72 |
|
73 |
with gr.Row():
|
74 |
context = gr.Textbox(label="Optional Context", placeholder="Add any specific instructions or questions...")
|
@@ -85,5 +91,4 @@ with gr.Blocks() as demo:
|
|
85 |
outputs=output
|
86 |
)
|
87 |
|
88 |
-
# Launch the Gradio app
|
89 |
demo.launch(debug=True)
|
|
|
27 |
|
28 |
base64_images = encode_images(images)
|
29 |
|
30 |
+
# Combine all the base64 images into a single message
|
31 |
+
image_blocks = [
|
32 |
+
{"type": "image_url", "image_url": {"url": base64_image}}
|
33 |
+
for base64_image in base64_images
|
34 |
+
]
|
35 |
+
|
36 |
+
# Add the instructional text in the same message
|
37 |
+
content_block = {
|
38 |
+
"type": "text",
|
39 |
+
"text": '''
|
40 |
+
You're a helpful assistant that creates comprehensive testing instructions. Based on the screenshot of app interface you should tell:
|
41 |
|
42 |
- **Description**: A brief explanation of the feature being tested.
|
43 |
- **Pre-conditions**: The required setup or state of the app before beginning the test.
|
|
|
53 |
5. **Offers**: Showcases available promotions and discounts.
|
54 |
6. **Filters**: Options to filter buses by time, price, or other preferences.
|
55 |
7. **Bus Information**: Provides details about the selected bus, including amenities, photos, and reviews.
|
56 |
+
'''}
|
57 |
+
|
58 |
+
# Single message combining all image URLs and text
|
59 |
+
completion = client.chat.completions.create(
|
60 |
+
model="llava-v1.5-7b-4096-preview",
|
61 |
+
messages=[
|
62 |
+
{
|
63 |
+
"role": "user",
|
64 |
+
"content": image_blocks + [content_block] # Add images and text as one user message
|
65 |
+
}
|
66 |
+
],
|
67 |
+
temperature=0,
|
68 |
+
max_tokens=1024,
|
69 |
+
top_p=1,
|
70 |
+
stream=False,
|
71 |
+
stop=None,
|
72 |
+
)
|
73 |
+
|
74 |
return completion.choices[0].message.content
|
75 |
|
|
|
76 |
with gr.Blocks() as demo:
|
77 |
+
gr.Markdown("## 🚌 Red Bus App Testing Instructions Generator")
|
78 |
|
79 |
with gr.Row():
|
80 |
context = gr.Textbox(label="Optional Context", placeholder="Add any specific instructions or questions...")
|
|
|
91 |
outputs=output
|
92 |
)
|
93 |
|
|
|
94 |
demo.launch(debug=True)
|