WeixuanYuan commited on
Commit
5ab36ff
1 Parent(s): b400f9a
Files changed (1) hide show
  1. app.py +18 -1
app.py CHANGED
@@ -1,7 +1,24 @@
1
  import gradio as gr
 
 
 
 
2
 
3
  def greet(name):
4
  return "Hello " + name + "!!"
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  iface.launch()
 
1
  import gradio as gr
2
+ import torch.nn as nn
3
+ from huggingface_hub import PyTorchModelHubMixin
4
+
5
+ # os.system('pip install torch')
6
 
7
  def greet(name):
8
  return "Hello " + name + "!!"
9
 
10
+ class MyModel(nn.Module, PyTorchModelHubMixin):
11
+ def __init__(self):
12
+ super(MyModel, self).__init__()
13
+ self.linear = nn.Linear(20,50)
14
+
15
+ def forward(self, x):
16
+ return x+2
17
+
18
+ model = MyModel.from_pretrained('WeixuanYuan/test_upload_private', use_auth_token='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')
19
+
20
+ def plus_two(input):
21
+ return model(int(input))
22
+
23
+ iface = gr.Interface(fn=plus_two, inputs="text", outputs="text")
24
  iface.launch()