|
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): |
|
|
|
|
|
|
|
|
|
|
|
return f"Hello {model.bn1.running_mean.data} !!" |
|
|
|
iface = gr.Interface(fn=greet, inputs="text", outputs="text") |
|
iface.launch() |