Update app.py
Browse files
app.py
CHANGED
@@ -29,7 +29,7 @@ def generate(file, temperature, max_new_tokens, top_p, repetition_penalty):
|
|
29 |
sentences = text.split('.')
|
30 |
random.shuffle(sentences) # Shuffle sentences
|
31 |
|
32 |
-
|
33 |
with tempfile.NamedTemporaryFile(mode='w', newline='', delete=False, suffix='.csv') as tmp:
|
34 |
writer = csv.writer(tmp)
|
35 |
|
@@ -52,7 +52,7 @@ def generate(file, temperature, max_new_tokens, top_p, repetition_penalty):
|
|
52 |
output = ""
|
53 |
for response in stream:
|
54 |
output += response.token.text
|
55 |
-
writer.writerow([sentence, output])
|
56 |
except Exception as e:
|
57 |
print(f"Error generating data for sentence '{sentence}': {e}")
|
58 |
|
@@ -68,8 +68,8 @@ gr.Interface(
|
|
68 |
gr.Slider(label="Top-p (nucleus sampling)", value=0.95, minimum=0.0, maximum=1, step=0.05, interactive=True, info="Higher values sample more low-probability tokens"),
|
69 |
gr.Slider(label="Repetition penalty", value=1.0, minimum=1.0, maximum=2.0, step=0.1, interactive=True, info="Penalize repeated tokens"),
|
70 |
],
|
71 |
-
outputs=gr.File(label="Synthetic Data
|
72 |
-
title="
|
73 |
-
description="
|
74 |
allow_flagging="never",
|
75 |
).launch()
|
|
|
29 |
sentences = text.split('.')
|
30 |
random.shuffle(sentences) # Shuffle sentences
|
31 |
|
32 |
+
|
33 |
with tempfile.NamedTemporaryFile(mode='w', newline='', delete=False, suffix='.csv') as tmp:
|
34 |
writer = csv.writer(tmp)
|
35 |
|
|
|
52 |
output = ""
|
53 |
for response in stream:
|
54 |
output += response.token.text
|
55 |
+
writer.writerow([sentence, output])
|
56 |
except Exception as e:
|
57 |
print(f"Error generating data for sentence '{sentence}': {e}")
|
58 |
|
|
|
68 |
gr.Slider(label="Top-p (nucleus sampling)", value=0.95, minimum=0.0, maximum=1, step=0.05, interactive=True, info="Higher values sample more low-probability tokens"),
|
69 |
gr.Slider(label="Repetition penalty", value=1.0, minimum=1.0, maximum=2.0, step=0.1, interactive=True, info="Penalize repeated tokens"),
|
70 |
],
|
71 |
+
outputs=gr.File(label="Synthetic Data "),
|
72 |
+
title="SDG",
|
73 |
+
description="AYE QABIL.",
|
74 |
allow_flagging="never",
|
75 |
).launch()
|