File size: 643 Bytes
b400f9a
5ab36ff
 
 
4184033
b400f9a
 
 
 
5ab36ff
 
 
 
 
 
 
 
 
 
 
 
 
 
b400f9a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import gradio as gr
import torch.nn as nn
from huggingface_hub import PyTorchModelHubMixin

os.system('pip install transformers')

def greet(name):
    return "Hello " + name + "!!"

class MyModel(nn.Module, PyTorchModelHubMixin):
    def __init__(self):
        super(MyModel, self).__init__()
        self.linear = nn.Linear(20,50)

    def forward(self, x):
        return x+2
        
model = MyModel.from_pretrained('WeixuanYuan/test_upload_private', use_auth_token='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')

def plus_two(input):
    return model(int(input))

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