Spaces:
Runtime error
Runtime error
Update
Browse files
app.py
CHANGED
|
@@ -144,12 +144,25 @@ with gr.Blocks(css="style.css") as demo:
|
|
| 144 |
visible=os.getenv("SHOW_DUPLICATE_BUTTON") == "1",
|
| 145 |
)
|
| 146 |
|
| 147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
with gr.Accordion(label="Advanced settings", open=False):
|
| 149 |
sampling_method = gr.Radio(
|
| 150 |
label="Text Decoding Method",
|
| 151 |
choices=["Beam search", "Nucleus sampling"],
|
| 152 |
-
value="
|
| 153 |
)
|
| 154 |
temperature = gr.Slider(
|
| 155 |
label="Temperature",
|
|
@@ -175,20 +188,6 @@ with gr.Blocks(css="style.css") as demo:
|
|
| 175 |
value=1.5,
|
| 176 |
step=0.5,
|
| 177 |
)
|
| 178 |
-
with gr.Row():
|
| 179 |
-
with gr.Column():
|
| 180 |
-
with gr.Box():
|
| 181 |
-
caption_button = gr.Button(value="Caption it!")
|
| 182 |
-
caption_output = gr.Textbox(label="Caption Output", show_label=False)
|
| 183 |
-
with gr.Column():
|
| 184 |
-
with gr.Box():
|
| 185 |
-
chatbot = gr.Chatbot(label="VQA Chat")
|
| 186 |
-
history_orig = gr.State(value=[])
|
| 187 |
-
history_qa = gr.State(value=[])
|
| 188 |
-
vqa_input = gr.Text(label="Chat Input", show_label=False, max_lines=1)
|
| 189 |
-
with gr.Row():
|
| 190 |
-
clear_chat_button = gr.Button(value="Clear")
|
| 191 |
-
chat_button = gr.Button(value="Submit")
|
| 192 |
|
| 193 |
gr.Examples(
|
| 194 |
examples=examples,
|
|
@@ -227,12 +226,22 @@ with gr.Blocks(css="style.css") as demo:
|
|
| 227 |
fn=chat,
|
| 228 |
inputs=chat_inputs,
|
| 229 |
outputs=chat_outputs,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 230 |
)
|
| 231 |
chat_button.click(
|
| 232 |
fn=chat,
|
| 233 |
inputs=chat_inputs,
|
| 234 |
outputs=chat_outputs,
|
| 235 |
api_name="chat",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 236 |
)
|
| 237 |
clear_chat_button.click(
|
| 238 |
fn=lambda: ("", [], [], []),
|
|
|
|
| 144 |
visible=os.getenv("SHOW_DUPLICATE_BUTTON") == "1",
|
| 145 |
)
|
| 146 |
|
| 147 |
+
with gr.Box():
|
| 148 |
+
image = gr.Image(type="pil")
|
| 149 |
+
with gr.Tabs():
|
| 150 |
+
with gr.Tab(label="Image Captioning"):
|
| 151 |
+
caption_button = gr.Button("Caption it!")
|
| 152 |
+
caption_output = gr.Textbox(label="Caption Output", show_label=False, container=False)
|
| 153 |
+
with gr.Tab(label="Visual Question Answering"):
|
| 154 |
+
chatbot = gr.Chatbot(label="VQA Chat")
|
| 155 |
+
history_orig = gr.State(value=[])
|
| 156 |
+
history_qa = gr.State(value=[])
|
| 157 |
+
vqa_input = gr.Text(label="Chat Input", show_label=False, max_lines=1, container=False)
|
| 158 |
+
with gr.Row():
|
| 159 |
+
clear_chat_button = gr.Button("Clear")
|
| 160 |
+
chat_button = gr.Button("Submit", variant="primary")
|
| 161 |
with gr.Accordion(label="Advanced settings", open=False):
|
| 162 |
sampling_method = gr.Radio(
|
| 163 |
label="Text Decoding Method",
|
| 164 |
choices=["Beam search", "Nucleus sampling"],
|
| 165 |
+
value="Nucleus sampling",
|
| 166 |
)
|
| 167 |
temperature = gr.Slider(
|
| 168 |
label="Temperature",
|
|
|
|
| 188 |
value=1.5,
|
| 189 |
step=0.5,
|
| 190 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 191 |
|
| 192 |
gr.Examples(
|
| 193 |
examples=examples,
|
|
|
|
| 226 |
fn=chat,
|
| 227 |
inputs=chat_inputs,
|
| 228 |
outputs=chat_outputs,
|
| 229 |
+
).success(
|
| 230 |
+
fn=lambda: "",
|
| 231 |
+
outputs=vqa_input,
|
| 232 |
+
queue=False,
|
| 233 |
+
api_name=False,
|
| 234 |
)
|
| 235 |
chat_button.click(
|
| 236 |
fn=chat,
|
| 237 |
inputs=chat_inputs,
|
| 238 |
outputs=chat_outputs,
|
| 239 |
api_name="chat",
|
| 240 |
+
).success(
|
| 241 |
+
fn=lambda: "",
|
| 242 |
+
outputs=vqa_input,
|
| 243 |
+
queue=False,
|
| 244 |
+
api_name=False,
|
| 245 |
)
|
| 246 |
clear_chat_button.click(
|
| 247 |
fn=lambda: ("", [], [], []),
|
style.css
CHANGED
|
@@ -8,3 +8,9 @@ h1 {
|
|
| 8 |
background: #1565c0;
|
| 9 |
border-radius: 100vh;
|
| 10 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
background: #1565c0;
|
| 9 |
border-radius: 100vh;
|
| 10 |
}
|
| 11 |
+
|
| 12 |
+
#component-0 {
|
| 13 |
+
max-width: 730px;
|
| 14 |
+
margin: auto;
|
| 15 |
+
padding-top: 1.5rem;
|
| 16 |
+
}
|