Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,26 @@
|
|
|
|
|
|
1 |
from datasets import load_dataset
|
2 |
|
|
|
3 |
# Load the dataset
|
4 |
dataset = load_dataset("MohamedRashad/arabic-books")
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
import gradio as gr
|
3 |
from datasets import load_dataset
|
4 |
|
5 |
+
|
6 |
# Load the dataset
|
7 |
dataset = load_dataset("MohamedRashad/arabic-books")
|
8 |
|
9 |
+
|
10 |
+
# Function to display the first row text
|
11 |
+
def get_first_text():
|
12 |
+
try:
|
13 |
+
return dataset['train'][0]['text']
|
14 |
+
except Exception as e:
|
15 |
+
return str(e)
|
16 |
+
|
17 |
+
|
18 |
+
# Create a Gradio Interface
|
19 |
+
interface = gr.Interface(
|
20 |
+
fn=get_first_text,
|
21 |
+
inputs=[],
|
22 |
+
outputs="text",
|
23 |
+
)
|
24 |
+
|
25 |
+
# Launch the interface
|
26 |
+
interface.launch()
|