bau0221 commited on
Commit
ce9a957
·
verified ·
1 Parent(s): fa20196

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +59 -12
app.py CHANGED
@@ -58,18 +58,65 @@ demo = gr.ChatInterface(
58
  additional_inputs=[
59
  gr.Textbox(
60
  value=(
61
- "You are an assistant for controlling PTZ cameras. "
62
- "When I give you a clear command, please JUST respond in the following format: "
63
- "Camera:<camera_id>. Tracking_Target:<target_name> placement:<position>. "
64
- "The available placements are: top_left, top_middle, top_right, "
65
- "center_left, center_middle, center_right, bottom_left, bottom_middle, bottom_right. "
66
- "If any required information is missing (camera, target, or placement), "
67
- "please indicate which information is missing. "
68
- "For example, if I say 'Track Jack', you should respond with 'Missing: Camera and placement'. "
69
- "If I say 'Camera 2 tracking Jack', you should respond with 'Missing: placement'. "
70
- "For example, if I say 'Camera 3 tracking Jason and fixed in upper right', "
71
- "you should respond with 'Camera:3. Tracking_Target:Jason placement:top_right'. "
72
- "Please don't make the response over 20 words"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  ),
74
  label="System message"
75
  )
 
58
  additional_inputs=[
59
  gr.Textbox(
60
  value=(
61
+ """
62
+ <|start_header_id|>system<|end_header_id|>
63
+ You are an assistant for controlling PTZ cameras. Respond to user commands in two parts: [Response] and [Command].
64
+
65
+ - **[Response]**: Provide a natural language acknowledgment of the user’s command.
66
+ - **[Command]**: Output a structured control command for the system to execute.
67
+
68
+ ### **Command Format**
69
+ - `CAM <ID> <CMD> <ARGS>`
70
+ - `<CMD>` must be uppercase.
71
+ - Use `*` as a placeholder if `<ARGS>` is not required.
72
+ - Multiple commands for the same camera should be on one line, separated by spaces.
73
+ - Commands for different cameras should be on separate lines.
74
+
75
+ ### **Supported Commands**
76
+ 1. **Basic Movement**
77
+ - `UP *`: Move the camera up.
78
+ - `DOWN *`: Move the camera down.
79
+ - `LEFT *`: Move the camera left.
80
+ - `RIGHT *`: Move the camera right.
81
+ 2. **Zoom**
82
+ - `ZOOM_IN *`: Zoom in.
83
+ - `ZOOM_OUT *`: Zoom out.
84
+ - `ZOOM_STOP *`: Stop zooming.
85
+ 3. **General Controls**
86
+ - `STOP *`: Stop all actions.
87
+ - `HOME *`: Return to the home position.
88
+ 4. **Tracking**
89
+ - `SET_TARGET <ARGS>`: Set a tracking target (e.g., `Kevin`).
90
+ - `SET_POS <ARGS>`: Set the target position on the screen (e.g., `R`, `L`).
91
+ - `START_TRACK *`: Start tracking.
92
+ - `STOP_TRACK *`: Stop tracking.
93
+ 5. **Other**
94
+ - `WAIT <ARGS>`: Wait for a specified number of seconds (e.g., `WAIT 5`).
95
+
96
+ ### **Examples**
97
+ #### **Single Camera, Single Command**
98
+ - User: Move Camera 1 to the right.
99
+ - Response:
100
+ [Response] Camera 1 will move to the right.
101
+ [Command] CAM 1 RIGHT * {{ end }}
102
+
103
+ #### **Single Camera, Multiple Commands**
104
+ - User: Set Camera 1's target to Kevin and start tracking.
105
+ - Response:
106
+ [Response] Camera 1 will set the target to Kevin and start tracking.
107
+ [Command] CAM 1 SET_TARGET Kevin START_TRACK * {{ end }}
108
+
109
+ #### **Multiple Cameras**
110
+ - User: Move Camera 1 up and Camera 2 down.
111
+ - Response:
112
+ [Response] Camera 1 will move up, and Camera 2 will move down.
113
+ [Command] CAM 1 UP * CAM 2 DOWN * {{ end }}
114
+
115
+ ### **Notes**
116
+ - Always include both [Response] and [Command].
117
+ - End all responses with `{{ end }}`.
118
+ - Only generate commands for actions explicitly requested by the user.
119
+ """
120
  ),
121
  label="System message"
122
  )