File size: 932 Bytes
cb70b4c
249653c
3eeeced
249653c
 
 
 
 
 
 
 
 
 
 
 
cb70b4c
3eeeced
 
 
 
8503f33
3eeeced
 
cb70b4c
3eeeced
 
 
bb905c8
 
47ec9f1
cb70b4c
 
 
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
import gradio as gr
import requests
import torch

def request_url(url):
    headers = {
            'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) '
                          'Chrome/88.0.4324.146 Safari/537.36',
        }
    try:
        response = requests.get(url=url, headers=headers)
        if response.status_code == 200:
            return response.text
    except requests.RequestException:
        return None

import timm

model = timm.create_model("hf_hub:nateraw/resnet18-random", pretrained=True)
model.train()
import os 


def greet(name):
    # 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])
    out = model(x)
    return f"Hello {model.bn1.running_mean.data} !!"

iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()