import gradio as gr import shutil import urllib.request import sys import os import urllib.request import zipfile sys.path.append(".") gr.close_all() urllib.request.urlretrieve("https://storage.googleapis.com/models-gradio/products/products.zip", "products.zip") with zipfile.ZipFile("products.zip", 'r') as zip_ref: zip_ref.extractall() from model import prediction def predict(img): prediction_img, text, t_process = prediction(img) return t_process, str(text), prediction_img, sample_images = ["dataset/" + name for name in os.listdir("dataset")] gr.Interface(fn=predict, inputs=[gr.Image(label="image à tester" ,type="filepath")], outputs=[gr.Textbox(label="temps"), gr.Textbox(label="analyse"), gr.Image(label ="résultat") ], css="footer {visibility: hidden} body}, .gradio-container {background-color: white}", examples=sample_images).launch(server_name="0.0.0.0", share=False)