heilbonn / app.py
Jim Dowling
updates
1fc1c7e
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"])