import gradio as gr import requests import torch import timm model = timm.create_model("hf_hub:nateraw/resnet18-random", pretrained=True) model.train() import os def greet(image): # url = f'https://huggingface.co/spaces?p=1&sort=modified&search=GPT' # html = request_url(url) # key = os.getenv("OPENAI_API_KEY") # x = torch.ones([1,3,224,224]) print(type(image)) image = torch.tensor(image).float() print(image.min(), image.max()) out = model(image) # model.train() return f"Hello {model.bn1.running_mean.data} !!" image = gr.inputs.Image(label="Upload a photo for beautify", shape=(224,224)) iface = gr.Interface(fn=greet, inputs=image, outputs="text") iface.launch()