import gradio as gr | |
from datasets import load_dataset | |
# Load the dataset | |
dataset = load_dataset("MohamedRashad/arabic-books") | |
# Function to display the first row text | |
def get_first_text(): | |
try: | |
return dataset['train'][0]['text'] | |
except Exception as e: | |
return str(e) | |
# Create a Gradio Interface | |
interface = gr.Interface( | |
fn=get_first_text, | |
inputs=[], | |
outputs="text", | |
) | |
# Launch the interface | |
interface.launch() | |