Update app.py
Browse files
app.py
CHANGED
@@ -10,7 +10,7 @@ tinier = AutoModelForCausalLM.from_pretrained("afrizalha/Sasando-1-7M", token=hf
|
|
10 |
|
11 |
desc = """Sasando-1 is a tiny, highly experimental text generator built using the Phi-3 architecture. It comes with two variations of microscopic sizes: 7M and 25M parameters. It is trained on a tightly-controlled Indo4B dataset filtered to only have 18000 unique words. The method is inspired by Microsoft's TinyStories paper which demonstrates that a tiny language model can produce fluent text when trained on tightly-controlled dataset.\n\nTry prompting with two simple words, and let the model continue. Fun examples provided below."""
|
12 |
|
13 |
-
def generate(starting_text=None, choice=None, temp=None, top_p=None
|
14 |
if info:
|
15 |
return desc
|
16 |
|
@@ -18,6 +18,8 @@ def generate(starting_text=None, choice=None, temp=None, top_p=None, info=False)
|
|
18 |
model = tinier
|
19 |
elif choice == '25M':
|
20 |
model = tiny
|
|
|
|
|
21 |
|
22 |
results = []
|
23 |
for i in range(5):
|
@@ -36,18 +38,17 @@ def generate(starting_text=None, choice=None, temp=None, top_p=None, info=False)
|
|
36 |
|
37 |
with gr.Blocks(theme=gr.themes.Soft()) as app:
|
38 |
starting_text = gr.Textbox(label="Starting text", value="cinta adalah")
|
39 |
-
choice = gr.Radio(["7M", "25M"], label="Select model",
|
40 |
-
info_button = gr.Button("Info")
|
41 |
|
42 |
-
with gr.Row():
|
43 |
-
temp = gr.Slider(label="Temperature", minimum=0.
|
44 |
-
top_p = gr.Slider(label="Top P", minimum=0.
|
45 |
|
46 |
res = gr.Textbox(label="Continuation")
|
47 |
|
48 |
gr.Interface(
|
49 |
fn=generate,
|
50 |
-
inputs=[starting_text, choice,
|
51 |
outputs=[res],
|
52 |
allow_flagging="never",
|
53 |
title="Sasando-1",
|
@@ -57,5 +58,4 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
57 |
["gue"], ["presiden"], ["cinta adalah"], ["allah, aku"], ["dia marah karena"],
|
58 |
["inflasi"], ["kolam renang"], ["messi"], ["jalan-jalan"], ["komputer itu"]
|
59 |
], [starting_text])
|
60 |
-
|
61 |
app.launch()
|
|
|
10 |
|
11 |
desc = """Sasando-1 is a tiny, highly experimental text generator built using the Phi-3 architecture. It comes with two variations of microscopic sizes: 7M and 25M parameters. It is trained on a tightly-controlled Indo4B dataset filtered to only have 18000 unique words. The method is inspired by Microsoft's TinyStories paper which demonstrates that a tiny language model can produce fluent text when trained on tightly-controlled dataset.\n\nTry prompting with two simple words, and let the model continue. Fun examples provided below."""
|
12 |
|
13 |
+
def generate(starting_text=None, choice=None, temp=None, top_p=None):
|
14 |
if info:
|
15 |
return desc
|
16 |
|
|
|
18 |
model = tinier
|
19 |
elif choice == '25M':
|
20 |
model = tiny
|
21 |
+
elif choice == "Info":
|
22 |
+
return desc
|
23 |
|
24 |
results = []
|
25 |
for i in range(5):
|
|
|
38 |
|
39 |
with gr.Blocks(theme=gr.themes.Soft()) as app:
|
40 |
starting_text = gr.Textbox(label="Starting text", value="cinta adalah")
|
41 |
+
choice = gr.Radio(["7M", "25M", "Info"], label="Select model", info="Built with the Phi-3 architecture", value='Info')
|
|
|
42 |
|
43 |
+
with gr.Row() as slider_options:
|
44 |
+
temp = gr.Slider(label="Temperature", minimum=0.1, maximum=1.0, step=0.1, value=0.7)
|
45 |
+
top_p = gr.Slider(label="Top P", minimum=0.1, maximum=1.0, step=0.1, value=0.5)
|
46 |
|
47 |
res = gr.Textbox(label="Continuation")
|
48 |
|
49 |
gr.Interface(
|
50 |
fn=generate,
|
51 |
+
inputs=[starting_text, choice, slider_options],
|
52 |
outputs=[res],
|
53 |
allow_flagging="never",
|
54 |
title="Sasando-1",
|
|
|
58 |
["gue"], ["presiden"], ["cinta adalah"], ["allah, aku"], ["dia marah karena"],
|
59 |
["inflasi"], ["kolam renang"], ["messi"], ["jalan-jalan"], ["komputer itu"]
|
60 |
], [starting_text])
|
|
|
61 |
app.launch()
|