Spaces:
Runtime error
Runtime error
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() |