Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,11 @@
|
|
1 |
-
import time
|
2 |
-
from threading import Thread
|
3 |
-
|
4 |
import gradio as gr
|
5 |
import torch
|
|
|
|
|
6 |
from PIL import Image
|
7 |
-
#from transformers import AutoProcessor, LlavaForConditionalGeneration
|
8 |
from transformers import TextIteratorStreamer
|
9 |
from transformers import LlavaNextForConditionalGeneration, LlavaNextProcessor
|
10 |
from PIL import Image
|
11 |
-
import requests
|
12 |
|
13 |
import spaces
|
14 |
|
@@ -65,9 +62,6 @@ def bot_streaming(message, history):
|
|
65 |
|
66 |
buffer = ""
|
67 |
for new_text in streamer:
|
68 |
-
# find <|eot_id|> and remove it from the new_text
|
69 |
-
if "<|eot_id|>" in new_text:
|
70 |
-
new_text = new_text.split("<|eot_id|>")[0]
|
71 |
buffer += new_text
|
72 |
yield buffer
|
73 |
|
@@ -80,7 +74,7 @@ with gr.Blocks(fill_height=True, ) as demo:
|
|
80 |
title="FalconVLM",
|
81 |
examples=[{"text": "What is on the flower?", "files": ["./bee.jpg"]},
|
82 |
{"text": "How to make this pastry?", "files": ["./baklava.png"]}],
|
83 |
-
description="Try [tiiuae/falcon-11B-VLM](https://huggingface.co/tiiuae/falcon-11B-vlm). 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.",
|
84 |
stop_btn="Stop Generation",
|
85 |
multimodal=True,
|
86 |
textbox=chat_input,
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
+
|
4 |
+
from threading import Thread
|
5 |
from PIL import Image
|
|
|
6 |
from transformers import TextIteratorStreamer
|
7 |
from transformers import LlavaNextForConditionalGeneration, LlavaNextProcessor
|
8 |
from PIL import Image
|
|
|
9 |
|
10 |
import spaces
|
11 |
|
|
|
62 |
|
63 |
buffer = ""
|
64 |
for new_text in streamer:
|
|
|
|
|
|
|
65 |
buffer += new_text
|
66 |
yield buffer
|
67 |
|
|
|
74 |
title="FalconVLM",
|
75 |
examples=[{"text": "What is on the flower?", "files": ["./bee.jpg"]},
|
76 |
{"text": "How to make this pastry?", "files": ["./baklava.png"]}],
|
77 |
+
description="Try [tiiuae/falcon-11B-VLM](https://huggingface.co/tiiuae/falcon-11B-vlm). 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. This is not the official demo.",
|
78 |
stop_btn="Stop Generation",
|
79 |
multimodal=True,
|
80 |
textbox=chat_input,
|