Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -87,8 +87,9 @@ model = model.merge_and_unload()
|
|
| 87 |
print("phi-3 model loaded sucessfully")
|
| 88 |
# 3. Inference Function
|
| 89 |
|
| 90 |
-
|
| 91 |
# 3. Inference Function
|
|
|
|
| 92 |
def predict(image, question):
|
| 93 |
"""
|
| 94 |
Takes an image and a question as input and returns an answer.
|
|
@@ -111,9 +112,9 @@ def predict(image, question):
|
|
| 111 |
prompt = f"Question: {question}\nImage Embeddings: {image_embeddings_str}\nAnswer:"
|
| 112 |
|
| 113 |
# Generate answer using llama.cpp
|
| 114 |
-
output =
|
| 115 |
prompt,
|
| 116 |
-
max_tokens=
|
| 117 |
stop=["Q:", "\n"],
|
| 118 |
echo=False,
|
| 119 |
)
|
|
|
|
| 87 |
print("phi-3 model loaded sucessfully")
|
| 88 |
# 3. Inference Function
|
| 89 |
|
| 90 |
+
|
| 91 |
# 3. Inference Function
|
| 92 |
+
@spaces.GPU
|
| 93 |
def predict(image, question):
|
| 94 |
"""
|
| 95 |
Takes an image and a question as input and returns an answer.
|
|
|
|
| 112 |
prompt = f"Question: {question}\nImage Embeddings: {image_embeddings_str}\nAnswer:"
|
| 113 |
|
| 114 |
# Generate answer using llama.cpp
|
| 115 |
+
output = model(
|
| 116 |
prompt,
|
| 117 |
+
max_tokens=128,
|
| 118 |
stop=["Q:", "\n"],
|
| 119 |
echo=False,
|
| 120 |
)
|