philipp-zettl commited on
Commit
085b760
1 Parent(s): 4837daf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -1,13 +1,12 @@
1
  import gradio as gr
2
- from huggingface_hub import InferenceClient
3
-
4
- """
5
- For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
6
- """
7
  from transformers import pipeline
 
8
 
9
- pipe = pipeline("text-generation", model="HuggingFaceTB/SmolLM-135M-Instruct")
10
-
 
 
11
 
12
  def respond(
13
  message,
 
1
  import gradio as gr
2
+ import torch
 
 
 
 
3
  from transformers import pipeline
4
+ from transformers import AutoModelForCausalLM, AutoTokenizer
5
 
6
+ model_name = 'HuggingFaceTB/SmolLM-135M-Instruct'
7
+ device = 'cuda' if torch.cuda.is_available() else 'cpu'
8
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
9
+ model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)
10
 
11
  def respond(
12
  message,