import gradio as gr from datasets import load_dataset # Load the dataset dataset = load_dataset("mohres/The_Arabic_E-Book_Corpus") def filter_arabic_novels(): # Select only rows containing novel-like words filtered_data = dataset['train'].filter(lambda x: "رواية" in x['text']) return filtered_data # 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=lambda: filter_arabic_novels()[0]['text'], # Only show first filtered sample inputs=[], outputs="text", ) # Launch the interface interface.launch()