File size: 1,355 Bytes
a22067d
 
 
 
 
132e068
 
 
 
 
d745a08
 
 
132e068
e9409f4
 
763da04
132e068
 
 
 
 
48a6a70
46ff20d
827e9ce
5b66ed1
132e068
 
 
 
 
 
 
 
 
 
 
 
a22067d
 
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
30
31
32
33
34
35
36
37
38
39
40
import gradio as gr

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


import torch
from transformers import pipeline
speech_recognizer = pipeline("automatic-speech-recognition", model="facebook/wav2vec2-base-960h")

from transformers import AutoConfig
config = AutoConfig.from_pretrained("dbmdz/bert-base-german-cased")

from datasets import load_dataset, Audio
# dataset = load_dataset("PolyAI/minds14", name="en-US", split="train")
# dataset = load_dataset("beans", split="train")
dataset = load_dataset("lmms-lab/LMMs-Eval-Lite", "ai2d")
dataset = dataset.cast_column("audio", Audio(sampling_rate=speech_recognizer.feature_extractor.sampling_rate))

result = speech_recognizer(dataset[:4]["audio"])
print([d["text"] for d in result])

# ;allenai/WildBench
# ==black-forest-labs/FLUX.1-dev==
#LLM360/TxT360 sasad
# iSolver-AI/FEnet

model_name = "nlptown/bert-base-multilingual-uncased-sentiment"

from transformers import AutoTokenizer, AutoModelForSequenceClassification

model = AutoModelForSequenceClassification.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)

classifier = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer)
classifier("Nous sommes très heureux de vous présenter la bibliothèque 🤗 Transformers.")


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