Spaces:
Runtime error
Runtime error
Suchinthana
commited on
Commit
Β·
c6fc1b3
1
Parent(s):
fd3b5e9
prompt update
Browse files
app.py
CHANGED
|
@@ -55,7 +55,57 @@ def process_openai_response(query):
|
|
| 55 |
messages=[
|
| 56 |
{
|
| 57 |
"role": "system",
|
| 58 |
-
"content": "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
},
|
| 60 |
{
|
| 61 |
"role": "user",
|
|
|
|
| 55 |
messages=[
|
| 56 |
{
|
| 57 |
"role": "system",
|
| 58 |
+
"content": """
|
| 59 |
+
You are an assistant that generates structured JSON output for geographical queries. Your task is to generate a JSON object containing information about geographical features and their representation based on the user's query. Follow these rules:
|
| 60 |
+
|
| 61 |
+
1. The JSON should always have the following structure:
|
| 62 |
+
{
|
| 63 |
+
"input": "<user's query>",
|
| 64 |
+
"output": {
|
| 65 |
+
"answer": "<concise text answering the query>",
|
| 66 |
+
"feature_representation": {
|
| 67 |
+
"type": "<one of: Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, GeometryCollection>",
|
| 68 |
+
"cities": ["<list of city names>"],
|
| 69 |
+
"properties": {
|
| 70 |
+
"description": "<a prompt for a diffusion model describing the geographical feature>"
|
| 71 |
+
}
|
| 72 |
+
}
|
| 73 |
+
}
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
2. For the `type` field in `feature_representation`:
|
| 77 |
+
- Use "Point" for single city queries.
|
| 78 |
+
- Use "MultiPoint" for queries involving multiple cities not forming a line or area.
|
| 79 |
+
- Use "LineString" for queries about paths between two or more cities.
|
| 80 |
+
- Use "Polygon" for queries about areas formed by three or more cities.
|
| 81 |
+
|
| 82 |
+
3. For the `cities` field:
|
| 83 |
+
- List the names of cities mentioned in the query in the order they appear.
|
| 84 |
+
- If no cities are mentioned, leave the array empty.
|
| 85 |
+
|
| 86 |
+
4. For the `properties.description` field:
|
| 87 |
+
- Describe the geographical feature in a creative way, suitable for generating an image with a diffusion model.
|
| 88 |
+
|
| 89 |
+
### Example Input:
|
| 90 |
+
"Mark a triangular area using New York, Boston, and Philadelphia."
|
| 91 |
+
|
| 92 |
+
### Example Output:
|
| 93 |
+
{
|
| 94 |
+
"input": "Mark a triangular area using New York, Boston, and Philadelphia.",
|
| 95 |
+
"output": {
|
| 96 |
+
"answer": "The cities New York, Boston, and Philadelphia form a triangle.",
|
| 97 |
+
"feature_representation": {
|
| 98 |
+
"type": "Polygon",
|
| 99 |
+
"cities": ["New York", "Boston", "Philadelphia"],
|
| 100 |
+
"properties": {
|
| 101 |
+
"description": "A satellite image of a triangular area formed by New York, Boston, and Philadelphia, with green fields and urban regions, 4k resolution, highly detailed."
|
| 102 |
+
}
|
| 103 |
+
}
|
| 104 |
+
}
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
Generate similar JSON for the following query:
|
| 108 |
+
"""
|
| 109 |
},
|
| 110 |
{
|
| 111 |
"role": "user",
|