Spaces:
Running
on
Zero
Running
on
Zero
update app
Browse files
app.py
CHANGED
@@ -51,7 +51,7 @@ class ThistleTheme(Soft):
|
|
51 |
neutral_hue: colors.Color | str = colors.slate,
|
52 |
text_size: sizes.Size | str = sizes.text_lg,
|
53 |
font: fonts.Font | str | Iterable[fonts.Font | str] = (
|
54 |
-
fonts.GoogleFont("
|
55 |
),
|
56 |
font_mono: fonts.Font | str | Iterable[fonts.Font | str] = (
|
57 |
fonts.GoogleFont("IBM Plex Mono"), "ui-monospace", "monospace",
|
@@ -372,17 +372,17 @@ def generate_gif(text: str, gif_path: str, max_new_tokens: int = 1024, temperatu
|
|
372 |
buffer = buffer.replace("<|im_end|>", "")
|
373 |
time.sleep(0.01)
|
374 |
yield buffer, buffer
|
375 |
-
|
376 |
-
image_examples = [["Perform OCR on the image precisely and reconstruct it correctly...", "examples/images/1.jpg"],
|
377 |
["Caption the image. Describe the safety measures shown in the image. Conclude whether the situation is (safe or unsafe)...", "examples/images/2.jpg"],
|
378 |
["Solve the problem...", "examples/images/3.png"]]
|
379 |
-
video_examples = [["Explain the Ad video in detail.", "examples/videos/1.mp4"],
|
380 |
["Explain the video in detail.", "examples/videos/2.mp4"]]
|
381 |
-
pdf_examples = [["Extract the content precisely.", "examples/pdfs/doc1.pdf"],
|
382 |
["Analyze and provide a short report.", "examples/pdfs/doc2.pdf"]]
|
383 |
gif_examples = [["Describe this GIF.", "examples/gifs/1.gif"],
|
384 |
["Describe this GIF.", "examples/gifs/2.gif"]]
|
385 |
-
caption_examples = [["https://huggingface.co/datasets/merve/vlm_test_images/resolve/main/candy.JPG"],
|
386 |
["examples/captions/2.png"], ["examples/captions/3.png"]]
|
387 |
|
388 |
with gr.Blocks(theme=thistle_theme, css=css) as demo:
|
@@ -440,21 +440,21 @@ with gr.Blocks(theme=thistle_theme, css=css) as demo:
|
|
440 |
output = gr.Textbox(label="Raw Output Stream", interactive=False, lines=14, show_copy_button=True)
|
441 |
with gr.Accordion("(Result.md)", open=False):
|
442 |
markdown_output = gr.Markdown(label="(Result.Md)")
|
443 |
-
|
444 |
-
image_submit.click(fn=generate_image,
|
445 |
-
inputs=[image_query, image_upload, max_new_tokens, temperature, top_p, top_k, repetition_penalty],
|
446 |
outputs=[output, markdown_output])
|
447 |
-
video_submit.click(fn=generate_video,
|
448 |
-
inputs=[video_query, video_upload, max_new_tokens, temperature, top_p, top_k, repetition_penalty],
|
449 |
outputs=[output, markdown_output])
|
450 |
pdf_submit.click(fn=generate_pdf,
|
451 |
-
inputs=[pdf_query, pdf_state, max_new_tokens, temperature, top_p, top_k, repetition_penalty],
|
452 |
outputs=[output, markdown_output])
|
453 |
-
gif_submit.click(fn=generate_gif,
|
454 |
-
inputs=[gif_query, gif_upload, max_new_tokens, temperature, top_p, top_k, repetition_penalty],
|
455 |
outputs=[output, markdown_output])
|
456 |
-
caption_submit.click(fn=generate_caption,
|
457 |
-
inputs=[caption_image_upload, max_new_tokens, temperature, top_p, top_k, repetition_penalty],
|
458 |
outputs=[output, markdown_output])
|
459 |
|
460 |
pdf_upload.change(fn=load_and_preview_pdf, inputs=[pdf_upload], outputs=[pdf_preview_img, pdf_state, page_info])
|
|
|
51 |
neutral_hue: colors.Color | str = colors.slate,
|
52 |
text_size: sizes.Size | str = sizes.text_lg,
|
53 |
font: fonts.Font | str | Iterable[fonts.Font | str] = (
|
54 |
+
fonts.GoogleFont("Outfit"), "Arial", "sans-serif",
|
55 |
),
|
56 |
font_mono: fonts.Font | str | Iterable[fonts.Font | str] = (
|
57 |
fonts.GoogleFont("IBM Plex Mono"), "ui-monospace", "monospace",
|
|
|
372 |
buffer = buffer.replace("<|im_end|>", "")
|
373 |
time.sleep(0.01)
|
374 |
yield buffer, buffer
|
375 |
+
|
376 |
+
image_examples = [["Perform OCR on the image precisely and reconstruct it correctly...", "examples/images/1.jpg"],
|
377 |
["Caption the image. Describe the safety measures shown in the image. Conclude whether the situation is (safe or unsafe)...", "examples/images/2.jpg"],
|
378 |
["Solve the problem...", "examples/images/3.png"]]
|
379 |
+
video_examples = [["Explain the Ad video in detail.", "examples/videos/1.mp4"],
|
380 |
["Explain the video in detail.", "examples/videos/2.mp4"]]
|
381 |
+
pdf_examples = [["Extract the content precisely.", "examples/pdfs/doc1.pdf"],
|
382 |
["Analyze and provide a short report.", "examples/pdfs/doc2.pdf"]]
|
383 |
gif_examples = [["Describe this GIF.", "examples/gifs/1.gif"],
|
384 |
["Describe this GIF.", "examples/gifs/2.gif"]]
|
385 |
+
caption_examples = [["https://huggingface.co/datasets/merve/vlm_test_images/resolve/main/candy.JPG"],
|
386 |
["examples/captions/2.png"], ["examples/captions/3.png"]]
|
387 |
|
388 |
with gr.Blocks(theme=thistle_theme, css=css) as demo:
|
|
|
440 |
output = gr.Textbox(label="Raw Output Stream", interactive=False, lines=14, show_copy_button=True)
|
441 |
with gr.Accordion("(Result.md)", open=False):
|
442 |
markdown_output = gr.Markdown(label="(Result.Md)")
|
443 |
+
|
444 |
+
image_submit.click(fn=generate_image,
|
445 |
+
inputs=[image_query, image_upload, max_new_tokens, temperature, top_p, top_k, repetition_penalty],
|
446 |
outputs=[output, markdown_output])
|
447 |
+
video_submit.click(fn=generate_video,
|
448 |
+
inputs=[video_query, video_upload, max_new_tokens, temperature, top_p, top_k, repetition_penalty],
|
449 |
outputs=[output, markdown_output])
|
450 |
pdf_submit.click(fn=generate_pdf,
|
451 |
+
inputs=[pdf_query, pdf_state, max_new_tokens, temperature, top_p, top_k, repetition_penalty],
|
452 |
outputs=[output, markdown_output])
|
453 |
+
gif_submit.click(fn=generate_gif,
|
454 |
+
inputs=[gif_query, gif_upload, max_new_tokens, temperature, top_p, top_k, repetition_penalty],
|
455 |
outputs=[output, markdown_output])
|
456 |
+
caption_submit.click(fn=generate_caption,
|
457 |
+
inputs=[caption_image_upload, max_new_tokens, temperature, top_p, top_k, repetition_penalty],
|
458 |
outputs=[output, markdown_output])
|
459 |
|
460 |
pdf_upload.change(fn=load_and_preview_pdf, inputs=[pdf_upload], outputs=[pdf_preview_img, pdf_state, page_info])
|