Spaces:
Sleeping
Sleeping
teowu
commited on
Commit
•
43ba66f
1
Parent(s):
067ff7d
add
Browse files- app.py +11 -12
- examples/211.jpg +0 -0
- examples/sausage.jpg +0 -0
app.py
CHANGED
@@ -119,7 +119,6 @@ def add_text(state, text, image, image_process_mode, request: gr.Request):
|
|
119 |
def http_bot(state, temperature, top_p, max_new_tokens, request: gr.Request):
|
120 |
logger.info(f"http_bot. ip: {request.client.host}")
|
121 |
start_tstamp = time.time()
|
122 |
-
|
123 |
if state.skip_next:
|
124 |
# This generate call is skipped due to invalid inputs
|
125 |
yield (state, state.to_gradio_chatbot()) + (no_change_btn,) * 5
|
@@ -205,17 +204,17 @@ def http_bot(state, temperature, top_p, max_new_tokens, request: gr.Request):
|
|
205 |
|
206 |
|
207 |
title_markdown = ("""
|
208 |
-
<h1 align="center"><a href="https://github.com/
|
209 |
|
210 |
-
<h2 align="center">
|
211 |
|
212 |
<h5 align="center"> If you like our project, please give us a star ✨ on Github for latest update. </h2>
|
213 |
|
214 |
<div align="center">
|
215 |
<div style="display:flex; gap: 0.25rem;" align="center">
|
216 |
-
<a href='https://github.com/
|
217 |
-
<a href="https://
|
218 |
-
<a href='https://github.com/
|
219 |
</div>
|
220 |
</div>
|
221 |
|
@@ -246,7 +245,7 @@ block_css = """
|
|
246 |
|
247 |
def build_demo(embed_mode):
|
248 |
textbox = gr.Textbox(show_label=False, placeholder="Enter text and press ENTER", container=False)
|
249 |
-
with gr.Blocks(title="mPLUG-
|
250 |
state = gr.State()
|
251 |
|
252 |
if not embed_mode:
|
@@ -262,8 +261,8 @@ def build_demo(embed_mode):
|
|
262 |
|
263 |
cur_dir = os.path.dirname(os.path.abspath(__file__))
|
264 |
gr.Examples(examples=[
|
265 |
-
[f"{cur_dir}/examples/
|
266 |
-
[f"{cur_dir}/examples/
|
267 |
], inputs=[imagebox, textbox])
|
268 |
|
269 |
with gr.Accordion("Parameters", open=True) as parameter_row:
|
@@ -272,7 +271,7 @@ def build_demo(embed_mode):
|
|
272 |
max_output_tokens = gr.Slider(minimum=0, maximum=1024, value=512, step=64, interactive=True, label="Max output tokens",)
|
273 |
|
274 |
with gr.Column(scale=8):
|
275 |
-
chatbot = gr.Chatbot(elem_id="Chatbot", label="
|
276 |
with gr.Row():
|
277 |
with gr.Column(scale=8):
|
278 |
textbox.render()
|
@@ -376,7 +375,7 @@ if __name__ == "__main__":
|
|
376 |
parser.add_argument("--concurrency-count", type=int, default=10)
|
377 |
parser.add_argument("--model-list-mode", type=str, default="once",
|
378 |
choices=["once", "reload"])
|
379 |
-
parser.add_argument("--model-path", type=str, default="
|
380 |
parser.add_argument("--device", type=str, default="cuda")
|
381 |
parser.add_argument("--load-8bit", action="store_true")
|
382 |
parser.add_argument("--load-4bit", action="store_true")
|
@@ -394,5 +393,5 @@ if __name__ == "__main__":
|
|
394 |
).launch(
|
395 |
server_name=args.host,
|
396 |
server_port=args.port,
|
397 |
-
share=
|
398 |
)
|
|
|
119 |
def http_bot(state, temperature, top_p, max_new_tokens, request: gr.Request):
|
120 |
logger.info(f"http_bot. ip: {request.client.host}")
|
121 |
start_tstamp = time.time()
|
|
|
122 |
if state.skip_next:
|
123 |
# This generate call is skipped due to invalid inputs
|
124 |
yield (state, state.to_gradio_chatbot()) + (no_change_btn,) * 5
|
|
|
204 |
|
205 |
|
206 |
title_markdown = ("""
|
207 |
+
<h1 align="center"><a href="https://github.com/Q-Future/Q-Instruct"><img src="https://avatars.githubusercontent.com/u/148673336?s=200&v=4", alt="Q-Instruct (mPLUG-Owl-2)" border="0" style="margin: 0 auto; height: 200px;" /></a> </h1>
|
208 |
|
209 |
+
<h2 align="center">Q-Instruct: Improving Low-level Visual Abilities for Multi-modality Foundation Models</h2>
|
210 |
|
211 |
<h5 align="center"> If you like our project, please give us a star ✨ on Github for latest update. </h2>
|
212 |
|
213 |
<div align="center">
|
214 |
<div style="display:flex; gap: 0.25rem;" align="center">
|
215 |
+
<a href='https://github.com/Q-Future/Q-Instruct'><img src='https://img.shields.io/badge/Github-Code-blue'></a>
|
216 |
+
<a href="https://Q-Instruct.github.io/Q-Instruct/fig/Q_Instruct_v0_1_preview.pdf"><img src="https://img.shields.io/badge/Arxiv-2311.0xxxx-red"></a>
|
217 |
+
<a href='https://github.com/Q-Future/Q-Instruct/stargazers'><img src='https://img.shields.io/github/stars/Q-Future/Q-Instruct.svg?style=social'></a>
|
218 |
</div>
|
219 |
</div>
|
220 |
|
|
|
245 |
|
246 |
def build_demo(embed_mode):
|
247 |
textbox = gr.Textbox(show_label=False, placeholder="Enter text and press ENTER", container=False)
|
248 |
+
with gr.Blocks(title="Q-Instruct-on-mPLUG-Owl-2", theme=gr.themes.Default(), css=block_css) as demo:
|
249 |
state = gr.State()
|
250 |
|
251 |
if not embed_mode:
|
|
|
261 |
|
262 |
cur_dir = os.path.dirname(os.path.abspath(__file__))
|
263 |
gr.Examples(examples=[
|
264 |
+
[f"{cur_dir}/examples/sausage.jpg", "Describe and evaluate the quality of the image."],
|
265 |
+
[f"{cur_dir}/examples/211.jpg", "Is this image clear?"],
|
266 |
], inputs=[imagebox, textbox])
|
267 |
|
268 |
with gr.Accordion("Parameters", open=True) as parameter_row:
|
|
|
271 |
max_output_tokens = gr.Slider(minimum=0, maximum=1024, value=512, step=64, interactive=True, label="Max output tokens",)
|
272 |
|
273 |
with gr.Column(scale=8):
|
274 |
+
chatbot = gr.Chatbot(elem_id="Chatbot", label="Q-Instruct-Chatbot", height=600)
|
275 |
with gr.Row():
|
276 |
with gr.Column(scale=8):
|
277 |
textbox.render()
|
|
|
375 |
parser.add_argument("--concurrency-count", type=int, default=10)
|
376 |
parser.add_argument("--model-list-mode", type=str, default="once",
|
377 |
choices=["once", "reload"])
|
378 |
+
parser.add_argument("--model-path", type=str, default="teowu/mplug_owl2_7b_448_qinstruct_preview_v0.1")
|
379 |
parser.add_argument("--device", type=str, default="cuda")
|
380 |
parser.add_argument("--load-8bit", action="store_true")
|
381 |
parser.add_argument("--load-4bit", action="store_true")
|
|
|
393 |
).launch(
|
394 |
server_name=args.host,
|
395 |
server_port=args.port,
|
396 |
+
share=True
|
397 |
)
|
examples/211.jpg
ADDED
examples/sausage.jpg
ADDED