heilbonn / app.py
Jim Dowling
show image
8b1bb25
raw
history blame
896 Bytes
import gradio as gr
from PIL import Image
import hopsworks
def greet(name):
return "Hello " + name + "!!"
name="prophet"
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
# Specify the local file path of the Python script to be uploaded
img_path = f"Models/{name}/{version}/images/fig1.png"
# Upload the Python script to the "Models", and overwrite if it already exists
downloaded_file_path = dataset_api.download(img_path, overwrite=True)
def show_image():
image = Image.open("fig1.png")
return image
# Define the Gradio interface
iface = gr.Interface(
fn=show_image,
inputs="text",
outputs="image",
title="Display PNG Image",
)
# Launch the interface
iface.launch()