Spaces:
Runtime error
Runtime error
Leon Seidel
commited on
Commit
·
048b41f
1
Parent(s):
84bdadf
Add title and descriptions
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ from prompt import smoke_detection_prompt
|
|
4 |
import gradio as gr
|
5 |
import spaces
|
6 |
|
7 |
-
model_name = "leon-se/ForestFireVLM-
|
8 |
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
|
9 |
model_name, torch_dtype="auto", device_map="auto"
|
10 |
)
|
@@ -40,7 +40,7 @@ def generate(image):
|
|
40 |
inputs = inputs.to("cuda")
|
41 |
|
42 |
# Inference: Generation of the output
|
43 |
-
generated_ids = model.generate(**inputs, max_new_tokens=300)
|
44 |
generated_ids_trimmed = [
|
45 |
out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
|
46 |
]
|
@@ -52,5 +52,8 @@ def generate(image):
|
|
52 |
inputs = gr.Image(type="pil", label="Input Image")
|
53 |
outputs = gr.JSON(label="Output")
|
54 |
|
|
|
|
|
|
|
55 |
demo = gr.Interface(fn=generate, inputs=inputs, outputs=outputs, deep_link=False)
|
56 |
demo.launch()
|
|
|
4 |
import gradio as gr
|
5 |
import spaces
|
6 |
|
7 |
+
model_name = "leon-se/ForestFireVLM-7B"
|
8 |
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
|
9 |
model_name, torch_dtype="auto", device_map="auto"
|
10 |
)
|
|
|
40 |
inputs = inputs.to("cuda")
|
41 |
|
42 |
# Inference: Generation of the output
|
43 |
+
generated_ids = model.generate(**inputs, max_new_tokens=300, do_sample=False)
|
44 |
generated_ids_trimmed = [
|
45 |
out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
|
46 |
]
|
|
|
52 |
inputs = gr.Image(type="pil", label="Input Image")
|
53 |
outputs = gr.JSON(label="Output")
|
54 |
|
55 |
+
title = "ForestFireVLM-7B"
|
56 |
+
description = "This is a ForestFireVLM-7B, a finetune of Qwen2.5-VL-7B-Instruct. This demo shows how Vision-Language Models can give detailled and structured captions for forest fires from UAV perspectives."
|
57 |
+
|
58 |
demo = gr.Interface(fn=generate, inputs=inputs, outputs=outputs, deep_link=False)
|
59 |
demo.launch()
|