Karzan commited on
Commit
87d5c36
·
verified ·
1 Parent(s): 7a18002

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -6
app.py CHANGED
@@ -1,8 +1,25 @@
1
  import gradio as gr
2
- import os
3
 
4
- hf_token = os.environ.get('HF_TOKEN')
5
- gr.Interface.load("models/Karzan/bart-base-quran-transliteration",
6
- hf_token=hf_token,
7
- inputs=gr.Textbox(lines=5, label="Input Text") # customizes the input component
8
- ).launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ from transformers import pipeline
3
 
4
+ # model = AutoModelForCausalLM.from_pretrained("Karzan/ckb-gpt2-medium-base-test-1024")
5
+ model_id = "Karzan/bart-base-quran-transliteration"
6
+ pipe = pipeline("text2text-generation", model=model_id, max_length=1024)
7
+
8
+
9
+ def casual_model_function(input_text):
10
+ # Replace the line below with the code for your casual model
11
+ output_text = pipe(input_text)[0]['generated_text']
12
+ return output_text
13
+ text_input = gr.Textbox(lines=10, placeholder="Enter your text here", label="Your Text")
14
+ text_outputs = gr.Textbox(lines=10)
15
+ # submit_btn = gr.Button(value="Generate",variant="secondary")
16
+
17
+ interface = gr.Interface(
18
+ fn=casual_model_function,
19
+ inputs=text_input,
20
+ outputs=text_outputs,
21
+ # submit_btn=submit_btn,
22
+ )
23
+
24
+ if __name__ == "__main__":
25
+ interface.launch()