Spaces:
Sleeping
Sleeping
Delete test-model
Browse files- test-model +0 -25
test-model
DELETED
@@ -1,25 +0,0 @@
|
|
1 |
-
from transformers.utils import logging
|
2 |
-
logging.set_verbosity_error()
|
3 |
-
|
4 |
-
import warnings
|
5 |
-
warnings.filterwarnings("ignore",
|
6 |
-
message="Using the model-agnostic default `max_length`")
|
7 |
-
import os
|
8 |
-
import gradio as gr
|
9 |
-
from transformers import pipeline
|
10 |
-
|
11 |
-
pipe = pipeline("image-to-text",
|
12 |
-
model="./models/Salesforce/blip-image-captioning-base")
|
13 |
-
|
14 |
-
def launch(input):
|
15 |
-
out = pipe(input)
|
16 |
-
return out[0]['generated_text']
|
17 |
-
|
18 |
-
iface = gr.Interface(launch,
|
19 |
-
inputs=gr.Image(type='pil'),
|
20 |
-
outputs="text")
|
21 |
-
|
22 |
-
iface.launch(share=True,
|
23 |
-
server_port=int(os.environ['PORT1']))
|
24 |
-
|
25 |
-
iface.close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|