dwb2023 commited on
Commit
6bf2756
1 Parent(s): 1efd233

AutoModel test

Browse files
Files changed (1) hide show
  1. app.py +6 -11
app.py CHANGED
@@ -1,14 +1,9 @@
1
  import gradio as gr
2
- import spaces
3
- import torch
4
 
5
- zero = torch.Tensor([0]).cuda()
6
- print(zero.device) # <-- 'cpu' 🤔
 
7
 
8
- @spaces.GPU
9
- def greet(n):
10
- print(zero.device) # <-- 'cuda:0' 🤗
11
- return f"Hello {zero + n} Tensor"
12
-
13
- demo = gr.Interface(fn=greet, inputs=gr.Number(), outputs=gr.Text())
14
- demo.launch()
 
1
  import gradio as gr
2
+ from transformers import AutoModel
 
3
 
4
+ def get_model_summary(model_name):
5
+ model = AutoModel.from_pretrained(model_name)
6
+ return str(model)
7
 
8
+ interface = gr.Interface(fn=get_model_summary, inputs="text", outputs="text")
9
+ interface.launch()