File size: 896 Bytes
b336567
8b1bb25
 
b336567
 
 
 
8b1bb25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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()