Spaces:
Runtime error
Runtime error
kmkarakaya
commited on
Commit
·
30016b4
1
Parent(s):
66bf2b6
Update app.py
Browse files
app.py
CHANGED
@@ -1,37 +1,19 @@
|
|
1 |
-
import tensorflow as tf
|
2 |
-
from transformers import AutoTokenizer, TFGPT2LMHeadModel
|
3 |
import gradio as gr
|
4 |
|
5 |
-
|
6 |
-
|
|
|
|
|
|
|
|
|
7 |
|
8 |
-
def generate_review(prompt):
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
)
|
20 |
-
|
21 |
-
return(review_tokenizer.decode(output[0], skip_special_tokens=True))
|
22 |
-
|
23 |
-
demo = gr.Interface(fn=generate_review,
|
24 |
-
inputs="text",
|
25 |
-
outputs="text",
|
26 |
-
examples=[
|
27 |
-
"Bir hafta önce aldığım cep telefonu",
|
28 |
-
"Tatil için rezervasyon yaptırdım.",
|
29 |
-
"Henüz alalı bir"],
|
30 |
-
title="Review Generator",
|
31 |
-
description= """
|
32 |
-
Generate a review in Turkish by providing a prompt.
|
33 |
-
Generation takes 15 seconds on average.
|
34 |
-
Full Code is here: https://youtube.com/playlist?list=PLQflnv_s49v9d9w-L0S8XUXXdNks7vPBL
|
35 |
-
"""
|
36 |
-
)
|
37 |
-
demo.launch()
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
title="Review Generator"
|
4 |
+
description= "Generate a review in Turkish by providing a prompt. Generation takes 15 seconds on average."
|
5 |
+
article = "<p style='text-align: center'><a href='https://youtube.com/playlist?list=PLQflnv_s49v9d9w-L0S8XUXXdNks7vPBL' target='_blank'>Full Code is here: </a></p>"
|
6 |
+
examples=["Bir hafta önce aldığım cep telefonu",
|
7 |
+
"Tatil için rezervasyon yaptırdım.",
|
8 |
+
"Henüz alalı bir"]
|
9 |
|
|
|
10 |
|
11 |
+
gr.Interface.load(
|
12 |
+
"kmkarakaya/turkishReviews-ds",
|
13 |
+
inputs=gr.Textbox(lines=5, label="Input Text"),
|
14 |
+
title=title,
|
15 |
+
description=description,
|
16 |
+
article=article,
|
17 |
+
examples=examples,
|
18 |
+
enable_queue=True,
|
19 |
+
).launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|