Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,32 +2,25 @@ import gradio as gr
|
|
2 |
import requests
|
3 |
import torch
|
4 |
|
5 |
-
def request_url(url):
|
6 |
-
headers = {
|
7 |
-
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) '
|
8 |
-
'Chrome/88.0.4324.146 Safari/537.36',
|
9 |
-
}
|
10 |
-
try:
|
11 |
-
response = requests.get(url=url, headers=headers)
|
12 |
-
if response.status_code == 200:
|
13 |
-
return response.text
|
14 |
-
except requests.RequestException:
|
15 |
-
return None
|
16 |
-
|
17 |
import timm
|
18 |
|
19 |
model = timm.create_model("hf_hub:nateraw/resnet18-random", pretrained=True)
|
20 |
model.train()
|
|
|
21 |
import os
|
22 |
|
23 |
|
24 |
-
|
|
|
25 |
# url = f'https://huggingface.co/spaces?p=1&sort=modified&search=GPT'
|
26 |
# html = request_url(url)
|
27 |
# key = os.getenv("OPENAI_API_KEY")
|
28 |
-
|
29 |
-
|
|
|
|
|
30 |
return f"Hello {model.bn1.running_mean.data} !!"
|
31 |
|
32 |
-
|
|
|
33 |
iface.launch()
|
|
|
2 |
import requests
|
3 |
import torch
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
import timm
|
6 |
|
7 |
model = timm.create_model("hf_hub:nateraw/resnet18-random", pretrained=True)
|
8 |
model.train()
|
9 |
+
|
10 |
import os
|
11 |
|
12 |
|
13 |
+
|
14 |
+
def greet(image):
|
15 |
# url = f'https://huggingface.co/spaces?p=1&sort=modified&search=GPT'
|
16 |
# html = request_url(url)
|
17 |
# key = os.getenv("OPENAI_API_KEY")
|
18 |
+
# x = torch.ones([1,3,224,224])
|
19 |
+
print(type(image))
|
20 |
+
out = model(image)
|
21 |
+
# model.train()
|
22 |
return f"Hello {model.bn1.running_mean.data} !!"
|
23 |
|
24 |
+
image = gr.inputs.Image(label="Upload a photo for beautify", shape=(224,224))
|
25 |
+
iface = gr.Interface(fn=greet, inputs=image, outputs="text")
|
26 |
iface.launch()
|