morinop commited on
Commit
218afdd
1 Parent(s): 480545d

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -0
app.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 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
+ def greet(name):
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
+ # x = torch.ones([1,3,224,224])
29
+ # out = model(x)
30
+ return f"Hello {model.bn1.running_mean.data} !!"
31
+
32
+ iface = gr.Interface(fn=greet, inputs="text", outputs="text")
33
+ iface.launch()