Badr AlKhamissi
commited on
Commit
·
c476a27
1
Parent(s):
bc15e83
updated defaults
Browse files
app.py
CHANGED
@@ -19,9 +19,6 @@ feature_names = [
|
|
19 |
with open("./poet_names.json", 'r', encoding="utf-8") as fin:
|
20 |
poet_names = json.load(fin)
|
21 |
|
22 |
-
def greet(name):
|
23 |
-
return "Hello " + name + "!!"
|
24 |
-
|
25 |
def normalize_text(text):
|
26 |
text = araby.strip_tatweel(text)
|
27 |
return text
|
@@ -39,7 +36,7 @@ def generate_poem(country, era, meter, theme, lang_type, poet, num_lines, num_po
|
|
39 |
prompt += f"{name}: {feat}; "
|
40 |
prompt += f"Length: {num_lines}; Poem:"
|
41 |
|
42 |
-
num_beams =
|
43 |
top_k = 50
|
44 |
top_p = 0.9
|
45 |
r_penalty = 5.
|
@@ -96,19 +93,19 @@ with gr.Blocks(title=title) as demo:
|
|
96 |
)
|
97 |
|
98 |
with gr.Row():
|
99 |
-
inputs += [gr.Dropdown(countries, label="Country", value="
|
100 |
-
inputs += [gr.Dropdown(poet_era, label="Era", value="
|
101 |
with gr.Row():
|
102 |
-
inputs += [gr.Dropdown(meters, label="Meter", value="
|
103 |
-
inputs += [gr.Dropdown(themes, label="Theme", value="
|
104 |
with gr.Row():
|
105 |
-
inputs += [gr.Dropdown(language_types, label="Language Type", value="
|
106 |
-
inputs += [gr.Dropdown(poet_names, label="Poet", value="
|
107 |
with gr.Row():
|
108 |
-
inputs += [gr.Slider(2, 20, value=
|
109 |
inputs += [gr.Slider(1, 4, value=1, step=1, label="Number of Samples")]
|
110 |
with gr.Row():
|
111 |
-
inputs += [gr.Textbox(label="Title")]
|
112 |
|
113 |
btn = gr.Button("Generate")
|
114 |
examples = gr.Examples(examples="./examples", inputs=inputs)
|
|
|
19 |
with open("./poet_names.json", 'r', encoding="utf-8") as fin:
|
20 |
poet_names = json.load(fin)
|
21 |
|
|
|
|
|
|
|
22 |
def normalize_text(text):
|
23 |
text = araby.strip_tatweel(text)
|
24 |
return text
|
|
|
36 |
prompt += f"{name}: {feat}; "
|
37 |
prompt += f"Length: {num_lines}; Poem:"
|
38 |
|
39 |
+
num_beams = 5
|
40 |
top_k = 50
|
41 |
top_p = 0.9
|
42 |
r_penalty = 5.
|
|
|
93 |
)
|
94 |
|
95 |
with gr.Row():
|
96 |
+
inputs += [gr.Dropdown(countries, label="Country", value="مصر")]
|
97 |
+
inputs += [gr.Dropdown(poet_era, label="Era", value="العصر الحديث")]
|
98 |
with gr.Row():
|
99 |
+
inputs += [gr.Dropdown(meters, label="Meter", value="بحر السريع")]
|
100 |
+
inputs += [gr.Dropdown(themes, label="Theme", value="قصيدة رومنسيه")]
|
101 |
with gr.Row():
|
102 |
+
inputs += [gr.Dropdown(language_types, label="Language Type", value="فصحى")]
|
103 |
+
inputs += [gr.Dropdown(poet_names, label="Poet", value="أحمد شوقي")]
|
104 |
with gr.Row():
|
105 |
+
inputs += [gr.Slider(2, 20, value=6, step=1, label="Number of Lines")]
|
106 |
inputs += [gr.Slider(1, 4, value=1, step=1, label="Number of Samples")]
|
107 |
with gr.Row():
|
108 |
+
inputs += [gr.Textbox(label="Title", value="إثن عنان القلب واسلم به")]
|
109 |
|
110 |
btn = gr.Button("Generate")
|
111 |
examples = gr.Examples(examples="./examples", inputs=inputs)
|