import gradio as gr from transformers import pipeline # Load a simple model (fill-mask task as an example) model = pipeline("fill-mask", model="distilroberta-base") # Define the function to use the GPU def predict(text): return model(text) # Gradio Interface interface = gr.Interface(fn=predict, inputs="text", outputs="text") # Launch the interface if __name__ == "__main__": interface.launch()