Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -35,14 +35,20 @@ def model_inference(input_dict, history):
|
|
35 |
if text == "" and images:
|
36 |
gr.Error("Please input a text query along with the image(s).")
|
37 |
return
|
38 |
-
|
|
|
39 |
# Prepare messages for the model
|
40 |
messages = [
|
|
|
|
|
|
|
|
|
|
|
41 |
{
|
42 |
"role": "user",
|
43 |
"content": [
|
44 |
*[{"type": "image", "image": image} for image in images],
|
45 |
-
{"type": "text", "text":
|
46 |
],
|
47 |
}
|
48 |
]
|
@@ -79,7 +85,7 @@ examples = [
|
|
79 |
|
80 |
demo = gr.ChatInterface(
|
81 |
fn=model_inference,
|
82 |
-
description="# **
|
83 |
examples=examples,
|
84 |
textbox=gr.MultimodalTextbox(label="Query Input", file_types=["image"], file_count="multiple"),
|
85 |
stop_btn="Stop Generation",
|
|
|
35 |
if text == "" and images:
|
36 |
gr.Error("Please input a text query along with the image(s).")
|
37 |
return
|
38 |
+
system_message = "You are a helpful assistant good at solving problems with step-by-step reasoning. You should first think about the reasoning process in the mind and then provide the user with the answer. The reasoning process and answer are enclosed within <think> </think> and <answer> </answer> tags."
|
39 |
+
question_text = "In which country and within which first-level administrative region of that country was this picture taken? Please answer in the format of <answer>$country,administrative_area_level_1$</answer>?"
|
40 |
# Prepare messages for the model
|
41 |
messages = [
|
42 |
+
{
|
43 |
+
"role": "system",
|
44 |
+
"content": system_message
|
45 |
+
|
46 |
+
},
|
47 |
{
|
48 |
"role": "user",
|
49 |
"content": [
|
50 |
*[{"type": "image", "image": image} for image in images],
|
51 |
+
{"type": "text", "text": question_text},
|
52 |
],
|
53 |
}
|
54 |
]
|
|
|
85 |
|
86 |
demo = gr.ChatInterface(
|
87 |
fn=model_inference,
|
88 |
+
description="# **SeekWorld**",
|
89 |
examples=examples,
|
90 |
textbox=gr.MultimodalTextbox(label="Query Input", file_types=["image"], file_count="multiple"),
|
91 |
stop_btn="Stop Generation",
|