Spaces:
Sleeping
Sleeping
File size: 1,513 Bytes
1680c7c 87d5c36 1680c7c 87d5c36 3a9a357 87d5c36 3a9a357 87d5c36 3a9a357 8995d89 3a9a357 87d5c36 3a9a357 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
import gradio as gr
from transformers import pipeline
# model = AutoModelForCausalLM.from_pretrained("Karzan/ckb-gpt2-medium-base-test-1024")
model_id = "Karzan/bart-base-quran-transliteration"
pipe = pipeline("text2text-generation", model=model_id, max_length=1024)
def casual_model_function(input_text):
# Replace the line below with the code for your casual model
output_text = pipe(input_text)[0]["generated_text"]
return output_text
text_input = gr.Textbox(lines=10, placeholder="Enter your text here", label="Your Text")
text_outputs = gr.Textbox(lines=10)
# submit_btn = gr.Button(value="Generate",variant="secondary")
interface = gr.Interface(
fn=casual_model_function,
inputs=text_input,
outputs=text_outputs,
examples=[
["ٱلْحَمْدُ لِلَّهِ رَبِّ ٱلْعَـٰلَمِينَ", "ئەل حەمدو ليل لاهـى ڕەببـيل عالەمين"],
["ٱلرَّحْمَـٰنِ ٱلرَّحِيمِ", "ئەڕ ڕەحمانـيـڕ ڕەحيم"],
["فِى قُلُوبِهِم مَّرَضٌۭ فَزَادَهُمُ ٱللَّهُ مَرَضًۭا ۖ وَلَهُمْ عَذَابٌ أَلِيمٌۢ بِمَا كَانُوا۟ يَكْذِبُونَ","فـى قولوبـيـهيـم مەڕەضونۖ فەزادەهوموڵڵاهـو مەڕەض ۖ وەلەهوم عەذابـون ئەليمون بيـما كانوۗ يەكذيبـون"]
],
# submit_btn=submit_btn,
)
if __name__ == "__main__":
interface.launch()
|