Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,16 +1,18 @@
|
|
1 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
2 |
from transformers import pipeline
|
3 |
-
|
4 |
-
|
5 |
-
|
|
|
|
|
6 |
|
7 |
|
8 |
def text_generate(text):
|
9 |
-
generate_text = pipe(f"{text}", max_length = 200,top_k=
|
10 |
return generate_text[0]['generated_text']
|
11 |
|
12 |
|
13 |
-
|
14 |
exmp=["درمدی قیمتوں میں","ایک فیصلے میں کہا کہ"]
|
15 |
|
16 |
gr.Interface(fn=text_generate, inputs="text", outputs="text", examples=exmp,title= "FINE TUNE GPT2 FOR URDU NEWS TEXT GENERATION").launch()
|
|
|
1 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
2 |
from transformers import pipeline
|
3 |
+
import gradio as gr
|
4 |
+
|
5 |
+
#tokenizer = AutoTokenizer.from_pretrained("Imran1/gpt2-urdu-news")
|
6 |
+
#model = AutoModelForCausalLM.from_pretrained("Imran1/gpt2-urdu-news")
|
7 |
+
pipe = pipeline('text-generation',"Imran1/gpt2-urdu-news")
|
8 |
|
9 |
|
10 |
def text_generate(text):
|
11 |
+
generate_text = pipe(f"{text}", max_length = 200,top_k=2000, temperature=1.0, top_p=0.92)
|
12 |
return generate_text[0]['generated_text']
|
13 |
|
14 |
|
15 |
+
|
16 |
exmp=["درمدی قیمتوں میں","ایک فیصلے میں کہا کہ"]
|
17 |
|
18 |
gr.Interface(fn=text_generate, inputs="text", outputs="text", examples=exmp,title= "FINE TUNE GPT2 FOR URDU NEWS TEXT GENERATION").launch()
|