Spaces:
Sleeping
Sleeping
Ubuntu
commited on
Commit
Β·
c8ef715
1
Parent(s):
ebb51c2
Remove max tokens slider and simplify interface
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
3 |
|
4 |
-
# Load models
|
5 |
tokenizer_eng_to_darija = AutoTokenizer.from_pretrained("lachkarsalim/Helsinki-translation-English_Moroccan-Arabic")
|
6 |
model_eng_to_darija = AutoModelForSeq2SeqLM.from_pretrained("lachkarsalim/Helsinki-translation-English_Moroccan-Arabic")
|
7 |
|
@@ -39,17 +39,17 @@ def respond(message, translation_choice):
|
|
39 |
with gr.Blocks() as demo:
|
40 |
with gr.Row():
|
41 |
with gr.Column():
|
42 |
-
# Header with
|
43 |
gr.Markdown("""
|
44 |
<h1 style="text-align: center;">
|
45 |
-
π²π¦ π Moroccan Arabic Translation Demo
|
46 |
</h1>
|
47 |
<p style="text-align: center;">
|
48 |
π Dima Meghrib π <br>
|
49 |
Select the translation direction and type your text. <br>
|
50 |
-
Get quick translations between **English** and **Moroccan Arabic (Darija)**! π₯
|
51 |
</p>
|
52 |
-
<img src="https://moroccan-culture-image.s3.eu-north-1.amazonaws.com/2159558.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=ASIAW3MD7RUI6BPOSTGF%2F20250225%2Feu-north-1%2Fs3%2Faws4_request&X-Amz-Date=
|
53 |
style="width: 100px; display: block; margin: 20px auto;" alt="Dima Meghrib Logo" />
|
54 |
""")
|
55 |
|
@@ -67,6 +67,9 @@ with gr.Blocks() as demo:
|
|
67 |
# Right Column for Outputs
|
68 |
output = gr.Textbox(label="Translated Text", placeholder="Translation will appear here...")
|
69 |
|
|
|
|
|
|
|
70 |
# Define the action for submit
|
71 |
submit_button.click(fn=respond, inputs=[user_input, translation_choice], outputs=output)
|
72 |
|
@@ -74,3 +77,4 @@ with gr.Blocks() as demo:
|
|
74 |
demo.launch()
|
75 |
|
76 |
|
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
3 |
|
4 |
+
# Load both translation models from Hugging Face
|
5 |
tokenizer_eng_to_darija = AutoTokenizer.from_pretrained("lachkarsalim/Helsinki-translation-English_Moroccan-Arabic")
|
6 |
model_eng_to_darija = AutoModelForSeq2SeqLM.from_pretrained("lachkarsalim/Helsinki-translation-English_Moroccan-Arabic")
|
7 |
|
|
|
39 |
with gr.Blocks() as demo:
|
40 |
with gr.Row():
|
41 |
with gr.Column():
|
42 |
+
# Header with emojis and logo
|
43 |
gr.Markdown("""
|
44 |
<h1 style="text-align: center;">
|
45 |
+
π²π¦ π Moroccan Arabic Translation Demo π
|
46 |
</h1>
|
47 |
<p style="text-align: center;">
|
48 |
π Dima Meghrib π <br>
|
49 |
Select the translation direction and type your text. <br>
|
50 |
+
Get quick translations between **English** and **Moroccan Arabic (Darija)** or **Darija to Modern Standard Arabic (MSA)**! π₯
|
51 |
</p>
|
52 |
+
<img src="https://moroccan-culture-image.s3.eu-north-1.amazonaws.com/2159558.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=ASIAW3MD7RUI6BPOSTGF%2F20250225%2Feu-north-1%2Fs3%2Faws4_request&X-Amz-Date=20250225T213645Z&X-Amz-Expires=300&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEBUaCmV1LW5vcnRoLTEiSDBGAiEA2wC2GISJOKipdbfMelCGfMqoPHnVnM9aY0zmsgmINpACIQCkA5VvqMaCEHNVwJml3%2FBJu%2FQlrU120PByOy8dSEfkdSrqAwhPEAAaDDQ3MTExMjU4NDQ2NSIMosytLgjLE%2BjysHncKscD5SmK3%2FV7ycLFyJpg8GMUa2bi%2BB4Tlj4YLxW37IxScYWjA5dOLyc9NnJNQ87K73ZRJLFSv1sogcVvRQqOnq3Cjb1AQwtljD4MHBjPIpgy7QVBov%2BAdUMzehD7K%2FhL8ME2pLPMV70E12dSdRRpablepF3Y%2FrHU1S8s4HJ%2BDAmfEF6gmnexTRyXVIEYodn%2FqPtOR5oaUF17SGEmmKJBi4b2kLQN%2B353pYrkB8ciBn0gAScNVkkgs2PuDUmzcXtw%2F4qcASvZ%2F11za7YSO%2FPrK30tFrOuVQQgjaB2h4a5%2BETBuXdLDX6EkbnEmN2Rh2ZH0adBut2UnOR9AtR4lRHDtk7qnRrlof6byqCqjDHu9iaJVcBpNMojNo%2BFZMofqZrnKygggvCaJhI3a%2FmJo7v0moz0nRhljyCA18ieJ8PYIBwqGcc53MneKRBbyTrI%2F7lHimTQZ4RDiD8E42qyxyh5vYOOBd9ijYog%2FZEsvzzaLfQC1niWfT35NcpzNXn0QMp8vjHa3S57nV3vXY7uXqj7i6Hf0JGG8YrZ3bpizt3q%2FY1zSHc9RCrYALCmWm9xfXsxy4woC10vBTP9S9tYaKS1j60bOADWikoeemUw4Oj4vQY6kwKyzIUJZkcmGcdRVff6NtSS%2F7hCsUUtyoygbvXIudEFO2jQDChI%2Fx5YbO%2BPH3ynUKVjncXGmtWR7%2BoncsXjFg7xrzsYjBjmDuHWF1umN%2BnA%2FPng6CfJ%2Br%2BlI5VxjnZCAZsvbGEKp9xKSSUI9KXcdsOYC4sMzNm1NdzU3wuWPhlJHvv7Y6Ma%2FPQwUkfDCCBphGheYqiZrQieDLpcnI6TNiefFOzRipE27fbtJXwbzoXIIhlQdtML7LXsQq5XeISwXGRZjeIQo5bIF6ab5QpA%2BFcmvAiVQlAh%2Byqa2KMjZhVHiFxMcPZXb0lRO3y2lB40FGKbQ7SVyUrDJg6pE%2FF67NMhCkanOp34hhjZ4JlWbGcIeBTTPw%3D%3D&X-Amz-Signature=894ab5ded5a51c7c605a2cfa64e77f4e69692edc7401e4428441dcf0d43f9d3d&X-Amz-SignedHeaders=host&response-content-disposition=inline"
|
53 |
style="width: 100px; display: block; margin: 20px auto;" alt="Dima Meghrib Logo" />
|
54 |
""")
|
55 |
|
|
|
67 |
# Right Column for Outputs
|
68 |
output = gr.Textbox(label="Translated Text", placeholder="Translation will appear here...")
|
69 |
|
70 |
+
# Footer with your name at the bottom
|
71 |
+
gr.Markdown("<p style='text-align: center; font-size: 14px;'>Created by Eng Amal π</p>")
|
72 |
+
|
73 |
# Define the action for submit
|
74 |
submit_button.click(fn=respond, inputs=[user_input, translation_choice], outputs=output)
|
75 |
|
|
|
77 |
demo.launch()
|
78 |
|
79 |
|
80 |
+
|