Update app.py
Browse files
app.py
CHANGED
@@ -1,30 +1,8 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
# Select only rows containing novel-like words
|
10 |
-
filtered_data = dataset['train'].filter(lambda x: "رواية" in x['text'])
|
11 |
-
return filtered_data
|
12 |
-
|
13 |
-
|
14 |
-
# Function to display the first row text
|
15 |
-
def get_first_text():
|
16 |
-
try:
|
17 |
-
return dataset['train'][0]['text']
|
18 |
-
except Exception as e:
|
19 |
-
return str(e)
|
20 |
-
|
21 |
-
|
22 |
-
# Create a Gradio Interface
|
23 |
-
interface = gr.Interface(
|
24 |
-
fn=lambda: filter_arabic_novels()[0]['text'], # Only show first filtered sample
|
25 |
-
inputs=[],
|
26 |
-
outputs="text",
|
27 |
-
)
|
28 |
-
|
29 |
-
# Launch the interface
|
30 |
-
interface.launch()
|
|
|
1 |
+
# Use a pipeline as a high-level helper
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
messages = [
|
5 |
+
{"role": "user", "content": "Who are you?"},
|
6 |
+
]
|
7 |
+
pipe = pipeline("text-generation", model="Ruqiya/Fine-Tuning-Gemma-2b-it-for-Arabic")
|
8 |
+
pipe(messages)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|