Update app.py
Browse files
app.py
CHANGED
@@ -1,24 +1,33 @@
|
|
1 |
import gradio as gr
|
2 |
-
from transformers import pipeline
|
3 |
-
from PIL import Image
|
4 |
-
from helper import load_image_from_url, render_results_in_image
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
return processed_image
|
14 |
-
|
15 |
-
|
16 |
-
demo = gr.Interface(
|
17 |
-
fn=get_pipeline_prediction,
|
18 |
-
inputs=gr.Image(label="Input image",
|
19 |
-
type="pil"),
|
20 |
-
outputs=gr.Image(label="Output image with predicted instances",
|
21 |
-
type="pil")
|
22 |
-
)
|
23 |
-
|
24 |
-
demo.launch()
|
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
2 |
|
3 |
+
models = {
|
4 |
+
# "object-detection": "facebook/detr-resnet-50",
|
5 |
+
"image-classification": "microsoft/resnet-50",
|
6 |
+
"text-to-image": "runwayml/stable-diffusion-v1-5",
|
7 |
+
"image-to-text": "nlpconnect/vit-gpt2-image-captioning",
|
8 |
+
"audio-classification": "mtg-upf/discogs-maest-30s-pw-73e-ts",
|
9 |
+
"audio-to-audio": "speechbrain/mtl-mimic-voicebank",
|
10 |
+
"automatic-speech-recognition": "jonatasgrosman/wav2vec2-large-xlsr-53-english",
|
11 |
+
"conversational": "microsoft/DialoGPT-medium",
|
12 |
+
"feature-extraction": "cambridgeltl/SapBERT-from-PubMedBERT-fulltext",
|
13 |
+
"fill-mask": "bert-base-uncased",
|
14 |
+
"question-answering": "deepset/roberta-base-squad2",
|
15 |
+
"summarization": "facebook/bart-large-cnn",
|
16 |
+
"text-classification": "cardiffnlp/twitter-roberta-base-sentiment-latest",
|
17 |
+
"text-generation": "gpt2",
|
18 |
+
"text2text-generation": "vennify/t5-base-grammar-correction",
|
19 |
+
"translation": "Helsinki-NLP/opus-mt-fr-en",
|
20 |
+
"zero-shot-classification": "facebook/bart-large-mnli",
|
21 |
+
"sentence-similarity": "sentence-transformers/all-mpnet-base-v2",
|
22 |
+
"text-to-speech": "facebook/mms-tts-eng",
|
23 |
+
"token-classification": "benjamin/wtp-canine-s-1l",
|
24 |
+
"document-question-answering": "fxmarty/tiny-doc-qa-vision-encoder-decoder",
|
25 |
+
"visual-question-answering": "Salesforce/blip-vqa-capfilt-large",
|
26 |
+
}
|
27 |
|
28 |
+
with gr.Blocks() as demo:
|
29 |
+
gr.Markdown("## Gradio Pipelines Tasks")
|
30 |
+
for k, v in models.items():
|
31 |
+
with gr.Tab(k):
|
32 |
+
gr.load(v, src="models")
|
33 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|