File size: 863 Bytes
001ec76
3b089f7
b95268d
001ec76
 
b95268d
3b089f7
 
 
 
 
 
 
 
 
 
001ec76
 
3b089f7
001ec76
 
3b089f7
001ec76
 
 
 
3b089f7
001ec76
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import gradio as gr
# from transformers import pipeline

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



# classifier = pipeline("sentiment-analysis")
# classifier(
#     [
#         "I've been waiting for a HuggingFace course my whole life.",
#         "I hate this so much!",
#     ]
# )

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

# import torch
# from transformers import AutoTokenizer, AutoModelForSequenceClassification

# checkpoint = "distilbert-base-uncased-finetuned-sst-2-english"
# tokenizer = AutoTokenizer.from_pretrained(checkpoint)
# model = AutoModelForSequenceClassification.from_pretrained(checkpoint)
# sequences = ["I've been waiting for a HuggingFace course my whole life.", "So have I!"]

# tokens = tokenizer(sequences, padding=True, truncation=True, return_tensors="pt")
# output = model(**tokens)