Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,25 @@
|
|
1 |
import gradio as gr
|
2 |
-
import
|
3 |
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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()
|