Spaces:
Runtime error
Runtime error
ChandraP12330
commited on
Commit
•
99c25ce
1
Parent(s):
ce6ebb2
Update app.py
Browse files
app.py
CHANGED
@@ -86,15 +86,15 @@ if image_url:
|
|
86 |
logits_per_image = outputs.logits_per_image # this is the image-text similarity score
|
87 |
probs = logits_per_image.softmax(dim=1) # we can take the softmax to get the label probabilities
|
88 |
raw_context= scene_labels[probs.argmax(-1)]
|
89 |
-
|
90 |
-
context= 'the image is depicting scene of attack'
|
91 |
|
92 |
##BLIP
|
93 |
caption = image_to_text(image_url, max_new_tokens=200)
|
94 |
initial_caption= caption[0]['generated_text']
|
95 |
##gemini-1.0-pro-latest
|
96 |
##LLM
|
97 |
-
llm = ChatGoogleGenerativeAI(model="gemini-1.0-pro", google_api_key=GOOGLE_API_KEY, temperature=0.2, top_p=1, top_k=1,
|
98 |
safety_settings={
|
99 |
HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT: HarmBlockThreshold.BLOCK_NONE,
|
100 |
HarmCategory.HARM_CATEGORY_HARASSMENT: HarmBlockThreshold.BLOCK_NONE,
|
|
|
86 |
logits_per_image = outputs.logits_per_image # this is the image-text similarity score
|
87 |
probs = logits_per_image.softmax(dim=1) # we can take the softmax to get the label probabilities
|
88 |
raw_context= scene_labels[probs.argmax(-1)]
|
89 |
+
context= 'the image is depicting scene of '+ raw_context
|
90 |
+
#context= 'the image is depicting scene of attack'
|
91 |
|
92 |
##BLIP
|
93 |
caption = image_to_text(image_url, max_new_tokens=200)
|
94 |
initial_caption= caption[0]['generated_text']
|
95 |
##gemini-1.0-pro-latest
|
96 |
##LLM
|
97 |
+
llm = ChatGoogleGenerativeAI(model="gemini-1.0-pro-latest", google_api_key=GOOGLE_API_KEY, temperature=0.2, top_p=1, top_k=1,
|
98 |
safety_settings={
|
99 |
HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT: HarmBlockThreshold.BLOCK_NONE,
|
100 |
HarmCategory.HARM_CATEGORY_HARASSMENT: HarmBlockThreshold.BLOCK_NONE,
|