File size: 1,010 Bytes
b336567 8b1bb25 b336567 8b1bb25 a9ff082 8b1bb25 ad21bf1 8b1bb25 ad21bf1 1fc1c7e ad21bf1 8b1bb25 150a9cd 8b1bb25 150a9cd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
import gradio as gr
from PIL import Image
import hopsworks
def greet(name):
return "Hello " + name + "!!"
name="prophet"
img="fig2.png"
project = hopsworks.login()
# Get the dataset API for the current project
dataset_api = project.get_dataset_api()
mr = project.get_model_registry()
#get the version number for the latest model
version = mr.get_models(name)[-1].version
def show_image(img):
# Specify the local file path of the Python script to be uploaded
img_path = f"Models/{name}/{version}/images/{img}.png"
# Upload the Python script to the "Models", and overwrite if it already exists
downloaded_file_path = dataset_api.download(img_path, overwrite=True)
image = Image.open(f"{img}.png")
return image
# Define the Gradio interface
iface = gr.Interface(
fn=show_image,
inputs="textbox",
#gr.Textbox(label="Image Name"),
outputs="image",
title="Display PNG Image",
)
# Launch the interface
iface.launch(share=True)
#, inputs=["fig1","fig2"])
|