Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -152,6 +152,17 @@ def generate_video(text: str, video_path: str,
|
|
152 |
time.sleep(0.01)
|
153 |
yield buffer
|
154 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
# Create the Gradio Interface
|
156 |
with gr.Blocks() as demo:
|
157 |
gr.Markdown("# **Cosmos-Reason1 by [NVIDIA](https://huggingface.co/nvidia/Cosmos-Reason1-7B)**")
|
@@ -161,10 +172,18 @@ with gr.Blocks() as demo:
|
|
161 |
with gr.TabItem("Image Inference"):
|
162 |
image_query = gr.Textbox(label="Query Input", placeholder="Enter your query here...")
|
163 |
image_upload = gr.Image(type="pil", label="Upload Image")
|
|
|
|
|
|
|
|
|
164 |
image_submit = gr.Button("Submit")
|
165 |
with gr.TabItem("Video Inference"):
|
166 |
video_query = gr.Textbox(label="Query Input", placeholder="Enter your query here...")
|
167 |
video_upload = gr.Video(label="Upload Video")
|
|
|
|
|
|
|
|
|
168 |
video_submit = gr.Button("Submit")
|
169 |
with gr.Accordion("Advanced options", open=False):
|
170 |
max_new_tokens = gr.Slider(label="Max new tokens", minimum=1, maximum=MAX_MAX_NEW_TOKENS, step=1, value=DEFAULT_MAX_NEW_TOKENS)
|
|
|
152 |
time.sleep(0.01)
|
153 |
yield buffer
|
154 |
|
155 |
+
# Define examples for image and video inference
|
156 |
+
image_examples = [
|
157 |
+
["OCR the Text in the Image", "rolm/1.jpeg"],
|
158 |
+
["Describe the objects in the image", "rolm/2.jpeg"]
|
159 |
+
]
|
160 |
+
|
161 |
+
video_examples = [
|
162 |
+
["Explain the Ad in Detail", "examples/videoplayback.mp4"],
|
163 |
+
["Identify the main actions in the video", "examples/demo_video.mp4"]
|
164 |
+
]
|
165 |
+
|
166 |
# Create the Gradio Interface
|
167 |
with gr.Blocks() as demo:
|
168 |
gr.Markdown("# **Cosmos-Reason1 by [NVIDIA](https://huggingface.co/nvidia/Cosmos-Reason1-7B)**")
|
|
|
172 |
with gr.TabItem("Image Inference"):
|
173 |
image_query = gr.Textbox(label="Query Input", placeholder="Enter your query here...")
|
174 |
image_upload = gr.Image(type="pil", label="Upload Image")
|
175 |
+
gr.Examples(
|
176 |
+
examples=image_examples,
|
177 |
+
inputs=[image_query, image_upload]
|
178 |
+
)
|
179 |
image_submit = gr.Button("Submit")
|
180 |
with gr.TabItem("Video Inference"):
|
181 |
video_query = gr.Textbox(label="Query Input", placeholder="Enter your query here...")
|
182 |
video_upload = gr.Video(label="Upload Video")
|
183 |
+
gr.Examples(
|
184 |
+
examples=video_examples,
|
185 |
+
inputs=[video_query, video_upload]
|
186 |
+
)
|
187 |
video_submit = gr.Button("Submit")
|
188 |
with gr.Accordion("Advanced options", open=False):
|
189 |
max_new_tokens = gr.Slider(label="Max new tokens", minimum=1, maximum=MAX_MAX_NEW_TOKENS, step=1, value=DEFAULT_MAX_NEW_TOKENS)
|