File size: 595 Bytes
1efd233
86fbb40
ba50ca9
6bf2756
1efd233
c26a148
6bf2756
86fbb40
 
 
 
 
 
 
6bf2756
1efd233
86fbb40
6bf2756
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr
import torch
import spaces
from transformers import AutoModel

@spaces.GPU
def get_model_summary(model_name):
    # Check if CUDA is available and set the device accordingly
    device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
    
    # Load the model and move it to the selected device
    model = AutoModel.from_pretrained(model_name).to(device)
    
    # Return the model's architecture as a string
    return str(model)

# Create the Gradio interface
interface = gr.Interface(fn=get_model_summary, inputs="text", outputs="text")
interface.launch()