Update src/model.py
Browse files- src/model.py +5 -0
src/model.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
# Importing necessary libraries
|
|
|
2 |
import subprocess
|
3 |
import spaces
|
4 |
from transformers import AutoProcessor, AutoModelForCausalLM
|
@@ -28,6 +29,10 @@ def run_example(task_prompt, image, text_input=None):
|
|
28 |
Returns:
|
29 |
str: The parsed answer generated by the model.
|
30 |
"""
|
|
|
|
|
|
|
|
|
31 |
# If there is no text input, use the task prompt as the prompt
|
32 |
if text_input is None:
|
33 |
prompt = task_prompt
|
|
|
1 |
# Importing necessary libraries
|
2 |
+
import gradio as gr
|
3 |
import subprocess
|
4 |
import spaces
|
5 |
from transformers import AutoProcessor, AutoModelForCausalLM
|
|
|
29 |
Returns:
|
30 |
str: The parsed answer generated by the model.
|
31 |
"""
|
32 |
+
# Check if the image is provided
|
33 |
+
if not image:
|
34 |
+
gr.error("No image provided")
|
35 |
+
|
36 |
# If there is no text input, use the task prompt as the prompt
|
37 |
if text_input is None:
|
38 |
prompt = task_prompt
|