Spaces:
Running
on
Zero
Running
on
Zero
Update README.md
#28
by
ysharma
HF staff
- opened
README.md
CHANGED
@@ -4,10 +4,11 @@ emoji: 🔥
|
|
4 |
colorFrom: yellow
|
5 |
colorTo: green
|
6 |
sdk: gradio
|
7 |
-
sdk_version: 4.
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: apache-2.0
|
|
|
11 |
---
|
12 |
|
13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
4 |
colorFrom: yellow
|
5 |
colorTo: green
|
6 |
sdk: gradio
|
7 |
+
sdk_version: 4.28.3
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: apache-2.0
|
11 |
+
short_description: Meta Llama3 8b with Llava Multimodal capabilities
|
12 |
---
|
13 |
|
14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
CHANGED
@@ -9,6 +9,16 @@ from transformers import TextIteratorStreamer
|
|
9 |
|
10 |
import spaces
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
model_id = "xtuner/llava-llama-3-8b-v1_1-transformers"
|
13 |
|
14 |
processor = AutoProcessor.from_pretrained(model_id)
|
@@ -76,16 +86,20 @@ def bot_streaming(message, history):
|
|
76 |
yield generated_text_without_prompt
|
77 |
|
78 |
|
79 |
-
|
|
|
|
|
|
|
80 |
fn=bot_streaming,
|
81 |
-
fill_height=False,
|
82 |
title="LLaVA Llama-3-8B",
|
83 |
examples=[{"text": "What is on the flower?", "files": ["./bee.jpg"]},
|
84 |
{"text": "How to make this pastry?", "files": ["./baklava.png"]}],
|
85 |
description="Try [LLaVA Llama-3-8B](https://huggingface.co/xtuner/llava-llama-3-8b-v1_1-transformers). Upload an image and start chatting about it, or simply try one of the examples below. If you don't upload an image, you will receive an error.",
|
86 |
stop_btn="Stop Generation",
|
87 |
-
multimodal=True
|
88 |
-
|
|
|
|
|
89 |
|
90 |
demo.queue(api_open=False)
|
91 |
demo.launch(show_api=False, share=False)
|
|
|
9 |
|
10 |
import spaces
|
11 |
|
12 |
+
|
13 |
+
PLACEHOLDER = """
|
14 |
+
<div style="padding: 30px; text-align: center; display: flex; flex-direction: column; align-items: center;">
|
15 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/64ccdc322e592905f922a06e/DDIW0kbWmdOQWwy4XMhwX.png" style="width: 80%; max-width: 550px; height: auto; opacity: 0.55; ">
|
16 |
+
<h1 style="font-size: 28px; margin-bottom: 2px; opacity: 0.55;">LLaVA-Llama-3-8B</h1>
|
17 |
+
<p style="font-size: 18px; margin-bottom: 2px; opacity: 0.65;">Llava-Llama-3-8b is a LLaVA model fine-tuned from Meta-Llama-3-8B-Instruct and CLIP-ViT-Large-patch14-336 with ShareGPT4V-PT and InternVL-SFT by XTuner</p>
|
18 |
+
</div>
|
19 |
+
"""
|
20 |
+
|
21 |
+
|
22 |
model_id = "xtuner/llava-llama-3-8b-v1_1-transformers"
|
23 |
|
24 |
processor = AutoProcessor.from_pretrained(model_id)
|
|
|
86 |
yield generated_text_without_prompt
|
87 |
|
88 |
|
89 |
+
chatbot=gr.Chatbot(placeholder=PLACEHOLDER,scale=1)
|
90 |
+
chat_input = gr.MultimodalTextbox(interactive=True, file_types=["image"], placeholder="Enter message or upload file...", show_label=False)
|
91 |
+
with gr.Blocks(fill_height=True, ) as demo:
|
92 |
+
gr.ChatInterface(
|
93 |
fn=bot_streaming,
|
|
|
94 |
title="LLaVA Llama-3-8B",
|
95 |
examples=[{"text": "What is on the flower?", "files": ["./bee.jpg"]},
|
96 |
{"text": "How to make this pastry?", "files": ["./baklava.png"]}],
|
97 |
description="Try [LLaVA Llama-3-8B](https://huggingface.co/xtuner/llava-llama-3-8b-v1_1-transformers). Upload an image and start chatting about it, or simply try one of the examples below. If you don't upload an image, you will receive an error.",
|
98 |
stop_btn="Stop Generation",
|
99 |
+
multimodal=True,
|
100 |
+
textbox=chat_input,
|
101 |
+
chatbot=chatbot,
|
102 |
+
)
|
103 |
|
104 |
demo.queue(api_open=False)
|
105 |
demo.launch(show_api=False, share=False)
|