Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,21 +16,22 @@ HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
|
| 16 |
MODEL_ID = os.environ.get("MODEL_ID")
|
| 17 |
MODEL_NAME = MODEL_ID.split("/")[-1]
|
| 18 |
|
| 19 |
-
TITLE = "<h1>VL-Chatbox</h1>"
|
| 20 |
|
| 21 |
DESCRIPTION = f"""
|
| 22 |
<center>
|
| 23 |
-
<p
|
|
|
|
| 24 |
<br>
|
| 25 |
-
π MODEL NOW: <a href="https://hf.co/{MODEL_ID}">{MODEL_NAME}</a>
|
| 26 |
<br>
|
| 27 |
-
β¨ Tips:
|
| 28 |
<br>
|
| 29 |
β¨ Tips: Please increase MAX LENGTH when deal with file.
|
| 30 |
<br>
|
| 31 |
π€ Supported Format: pdf, txt, docx, pptx, md, png, jpg, webp
|
| 32 |
<br>
|
| 33 |
-
πββοΈ May be rebuilding from time to time
|
|
|
|
| 34 |
</center>"""
|
| 35 |
|
| 36 |
CSS = """
|
|
@@ -160,7 +161,7 @@ def stream_chat(message, history: list, temperature: float, max_length: int, top
|
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
-
chatbot = gr.Chatbot()
|
| 164 |
chat_input = gr.MultimodalTextbox(
|
| 165 |
interactive=True,
|
| 166 |
placeholder="Enter message or upload a file one time...",
|
|
@@ -168,14 +169,13 @@ chat_input = gr.MultimodalTextbox(
|
|
| 168 |
|
| 169 |
)
|
| 170 |
EXAMPLES = [
|
| 171 |
-
[{"text": "Describe
|
| 172 |
-
[{"text": "
|
| 173 |
-
[{"text": "
|
| 174 |
]
|
| 175 |
|
| 176 |
with gr.Blocks(css=CSS, theme="soft",fill_height=True) as demo:
|
| 177 |
gr.HTML(TITLE)
|
| 178 |
-
gr.HTML(DESCRIPTION)
|
| 179 |
gr.ChatInterface(
|
| 180 |
fn=stream_chat,
|
| 181 |
multimodal=True,
|
|
|
|
| 16 |
MODEL_ID = os.environ.get("MODEL_ID")
|
| 17 |
MODEL_NAME = MODEL_ID.split("/")[-1]
|
| 18 |
|
| 19 |
+
TITLE = "<h1>VL-Chatbox</h1><br><center>π MODEL NOW: <a href="https://hf.co/{MODEL_ID}">{MODEL_NAME}</a></center>"
|
| 20 |
|
| 21 |
DESCRIPTION = f"""
|
| 22 |
<center>
|
| 23 |
+
<p>
|
| 24 |
+
A Space for Vision/Multimodal
|
| 25 |
<br>
|
|
|
|
| 26 |
<br>
|
| 27 |
+
β¨ Tips: Send Messages or upload 1 IMAGE/FILE per time.
|
| 28 |
<br>
|
| 29 |
β¨ Tips: Please increase MAX LENGTH when deal with file.
|
| 30 |
<br>
|
| 31 |
π€ Supported Format: pdf, txt, docx, pptx, md, png, jpg, webp
|
| 32 |
<br>
|
| 33 |
+
πββοΈ May be rebuilding from time to time.
|
| 34 |
+
</p>
|
| 35 |
</center>"""
|
| 36 |
|
| 37 |
CSS = """
|
|
|
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
+
chatbot = gr.Chatbot(label="Chatbox", height=600, placeholder=DESCRIPTION)
|
| 165 |
chat_input = gr.MultimodalTextbox(
|
| 166 |
interactive=True,
|
| 167 |
placeholder="Enter message or upload a file one time...",
|
|
|
|
| 169 |
|
| 170 |
)
|
| 171 |
EXAMPLES = [
|
| 172 |
+
[{"text": "Describe this image in great detailed.", "files": ["./laptop.jpg"]}],
|
| 173 |
+
[{"text": "Please describe this image and guess where it is?", "files": ["./hotel.jpg"]}],
|
| 174 |
+
[{"text": "What's in the image, is it real happen?", "files": ["./spacecat.png"]}]
|
| 175 |
]
|
| 176 |
|
| 177 |
with gr.Blocks(css=CSS, theme="soft",fill_height=True) as demo:
|
| 178 |
gr.HTML(TITLE)
|
|
|
|
| 179 |
gr.ChatInterface(
|
| 180 |
fn=stream_chat,
|
| 181 |
multimodal=True,
|