Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -9,10 +9,8 @@ import spaces
|
|
9 |
|
10 |
processor = AutoProcessor.from_pretrained("ucsahin/TraVisionLM-base", trust_remote_code=True)
|
11 |
model = AutoModelForCausalLM.from_pretrained("ucsahin/TraVisionLM-base", trust_remote_code=True)
|
12 |
-
# model_od = AutoModelForCausalLM.from_pretrained("ucsahin/TraVisionLM-Object-Detection-v2", trust_remote_code=True)
|
13 |
|
14 |
model.to("cuda:0")
|
15 |
-
# model_od.to("cuda:0")
|
16 |
|
17 |
@spaces.GPU
|
18 |
def bot_streaming(message, history, max_tokens, temperature, top_p, top_k, repetition_penalty):
|
@@ -21,7 +19,6 @@ def bot_streaming(message, history, max_tokens, temperature, top_p, top_k, repet
|
|
21 |
image = message.files[-1].path
|
22 |
else:
|
23 |
# if there's no image uploaded for this turn, look for images in the past turns
|
24 |
-
# kept inside tuples, take the last one
|
25 |
for hist in history:
|
26 |
if type(hist[0])==tuple:
|
27 |
image = hist[0][0]
|
@@ -74,8 +71,6 @@ Yüklediğiniz resimleri açıklatabilir ve onlarla ilgili ucu açık sorular so
|
|
74 |
Detaylar için [ucsahin/TraVisionLM-base](https://huggingface.co/ucsahin/TraVisionLM-base) kontrol etmeyi unutmayın!
|
75 |
"""
|
76 |
|
77 |
-
# with gr.Blocks() as demo:
|
78 |
-
# with gr.Tab("Open-ended Questions (Soru-cevap)"):
|
79 |
with gr.Accordion("Generation parameters", open=False) as parameter_accordion:
|
80 |
max_tokens_item = gr.Slider(64, 1024, value=512, step=64, label="Max tokens")
|
81 |
temperature_item = gr.Slider(0.1, 2, value=0.6, step=0.1, label="Temperature")
|
@@ -102,5 +97,4 @@ demo = gr.ChatInterface(
|
|
102 |
multimodal=True
|
103 |
)
|
104 |
|
105 |
-
|
106 |
demo.launch(debug=True, max_file_size="5mb")
|
|
|
9 |
|
10 |
processor = AutoProcessor.from_pretrained("ucsahin/TraVisionLM-base", trust_remote_code=True)
|
11 |
model = AutoModelForCausalLM.from_pretrained("ucsahin/TraVisionLM-base", trust_remote_code=True)
|
|
|
12 |
|
13 |
model.to("cuda:0")
|
|
|
14 |
|
15 |
@spaces.GPU
|
16 |
def bot_streaming(message, history, max_tokens, temperature, top_p, top_k, repetition_penalty):
|
|
|
19 |
image = message.files[-1].path
|
20 |
else:
|
21 |
# if there's no image uploaded for this turn, look for images in the past turns
|
|
|
22 |
for hist in history:
|
23 |
if type(hist[0])==tuple:
|
24 |
image = hist[0][0]
|
|
|
71 |
Detaylar için [ucsahin/TraVisionLM-base](https://huggingface.co/ucsahin/TraVisionLM-base) kontrol etmeyi unutmayın!
|
72 |
"""
|
73 |
|
|
|
|
|
74 |
with gr.Accordion("Generation parameters", open=False) as parameter_accordion:
|
75 |
max_tokens_item = gr.Slider(64, 1024, value=512, step=64, label="Max tokens")
|
76 |
temperature_item = gr.Slider(0.1, 2, value=0.6, step=0.1, label="Temperature")
|
|
|
97 |
multimodal=True
|
98 |
)
|
99 |
|
|
|
100 |
demo.launch(debug=True, max_file_size="5mb")
|