Update app.py
Browse files
app.py
CHANGED
|
@@ -225,53 +225,13 @@ def create_instruct_demo():
|
|
| 225 |
return instruct_demo
|
| 226 |
|
| 227 |
|
| 228 |
-
def create_caption_demo():
|
| 229 |
-
with gr.Blocks() as instruct_demo:
|
| 230 |
-
with gr.Row():
|
| 231 |
-
with gr.Column():
|
| 232 |
-
img = gr.Image(label='Input', type='filepath')
|
| 233 |
-
max_len = gr.Slider(minimum=1, maximum=512,
|
| 234 |
-
value=64, label="Max length")
|
| 235 |
-
with gr.Accordion(label='Advanced options', open=False):
|
| 236 |
-
temp = gr.Slider(minimum=0, maximum=1,
|
| 237 |
-
value=0.1, label="Temperature")
|
| 238 |
-
top_p = gr.Slider(minimum=0, maximum=1,
|
| 239 |
-
value=0.75, label="Top p")
|
| 240 |
-
|
| 241 |
-
run_botton = gr.Button("Run")
|
| 242 |
-
|
| 243 |
-
with gr.Column():
|
| 244 |
-
outputs = gr.Textbox(lines=10, label="Output")
|
| 245 |
-
|
| 246 |
-
inputs = [img, max_len, temp, top_p]
|
| 247 |
-
|
| 248 |
-
examples = glob.glob("caption_demo/*.jpg")
|
| 249 |
-
examples = [
|
| 250 |
-
[x, 64, 0.1, 0.75]
|
| 251 |
-
for x in examples]
|
| 252 |
-
|
| 253 |
-
gr.Examples(
|
| 254 |
-
examples=examples,
|
| 255 |
-
inputs=inputs,
|
| 256 |
-
outputs=outputs,
|
| 257 |
-
fn=caption_generate,
|
| 258 |
-
cache_examples=os.getenv('SYSTEM') == 'spaces'
|
| 259 |
-
)
|
| 260 |
-
run_botton.click(fn=caption_generate, inputs=inputs, outputs=outputs)
|
| 261 |
-
return instruct_demo
|
| 262 |
-
|
| 263 |
-
|
| 264 |
description = """
|
| 265 |
-
#
|
| 266 |
-
The official demo for **LLaMA-Adapter: Efficient Fine-tuning of Language Models with Zero-init Attention**.
|
| 267 |
-
Please refer to our [arXiv paper](https://arxiv.org/abs/2303.16199) and [github](https://github.com/ZrrSkywalker/LLaMA-Adapter) for more details.
|
| 268 |
"""
|
| 269 |
|
| 270 |
with gr.Blocks(css='style.css') as demo:
|
| 271 |
gr.Markdown(description)
|
| 272 |
with gr.TabItem("Instruction-Following"):
|
| 273 |
create_instruct_demo()
|
| 274 |
-
with gr.TabItem("Image Captioning"):
|
| 275 |
-
create_caption_demo()
|
| 276 |
|
| 277 |
demo.queue(api_open=True, concurrency_count=1).launch()
|
|
|
|
| 225 |
return instruct_demo
|
| 226 |
|
| 227 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 228 |
description = """
|
| 229 |
+
# TAPA: xxx
|
|
|
|
|
|
|
| 230 |
"""
|
| 231 |
|
| 232 |
with gr.Blocks(css='style.css') as demo:
|
| 233 |
gr.Markdown(description)
|
| 234 |
with gr.TabItem("Instruction-Following"):
|
| 235 |
create_instruct_demo()
|
|
|
|
|
|
|
| 236 |
|
| 237 |
demo.queue(api_open=True, concurrency_count=1).launch()
|