chang pre_train to VitProcess
Build-Deploy-Actions
Details
Build-Deploy-Actions
Details
This commit is contained in:
parent
9de5caeb3a
commit
2c44f1747a
7
app.py
7
app.py
|
@ -1,5 +1,5 @@
|
|||
import gradio as gr
|
||||
from transformers import ViTImageProcessor, ViTModel
|
||||
from transformers import ViTImageProcessor, ViTForImageClassification
|
||||
from gradio.themes.utils import sizes
|
||||
theme = gr.themes.Default(radius_size=sizes.radius_none).set(
|
||||
block_label_text_color = '#4D63FF',
|
||||
|
@ -11,7 +11,8 @@ theme = gr.themes.Default(radius_size=sizes.radius_none).set(
|
|||
)
|
||||
|
||||
processor = ViTImageProcessor.from_pretrained('google/vit-large-patch16-224-in21k')
|
||||
model = ViTModel.from_pretrained('google/vit-large-patch16-224-in21k')
|
||||
#model = ViTModel.from_pretrained('google/vit-large-patch16-224-in21k')
|
||||
model = ViTForImageClassification.from_pretrained('google/vit-large-patch16-224-in21k')
|
||||
|
||||
def image_classification(image):
|
||||
inputs = processor(images=image, return_tensors="pt")
|
||||
|
@ -31,4 +32,4 @@ demo = gr.Interface(fn=image_classification,
|
|||
|
||||
if __name__ == "__main__":
|
||||
demo.queue(concurrency_count=10)
|
||||
demo.launch(server_name = "0.0.0.0")
|
||||
demo.launch(server_name = "0.0.0.0", share = True)
|
||||
|
|
Loading…
Reference in New Issue