Spaces:
Running
on
Zero
Running
on
Zero
update clip interrogator call
Browse files
app.py
CHANGED
@@ -2,7 +2,10 @@ import gradio as gr
|
|
2 |
import re
|
3 |
import os
|
4 |
hf_token = os.environ.get('HF_TOKEN')
|
5 |
-
|
|
|
|
|
|
|
6 |
|
7 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
8 |
|
@@ -48,11 +51,12 @@ def get_text_after_colon(input_text):
|
|
48 |
|
49 |
def infer(image_input, audience):
|
50 |
gr.Info('Calling CLIP Interrogator ...')
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
|
|
56 |
)
|
57 |
print(clipi_result)
|
58 |
|
|
|
2 |
import re
|
3 |
import os
|
4 |
hf_token = os.environ.get('HF_TOKEN')
|
5 |
+
|
6 |
+
from gradio_client import Client, handle_file
|
7 |
+
|
8 |
+
clipi_client = Client("fffiloni/CLIP-Interrogator-2")
|
9 |
|
10 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
11 |
|
|
|
51 |
|
52 |
def infer(image_input, audience):
|
53 |
gr.Info('Calling CLIP Interrogator ...')
|
54 |
+
|
55 |
+
clipi_result = client.predict(
|
56 |
+
image=handle_file(image_input),
|
57 |
+
mode="best",
|
58 |
+
best_max_flavors=4,
|
59 |
+
api_name="/clipi2"
|
60 |
)
|
61 |
print(clipi_result)
|
62 |
|