Update app.py
Browse files
app.py
CHANGED
@@ -58,8 +58,10 @@ def generate(file, temperature, max_new_tokens, top_p, repetition_penalty):
|
|
58 |
save_to_csv(sentence, f"Error: {e}")
|
59 |
|
60 |
# CSV dosyasını okuyup byte olarak döndür
|
61 |
-
with open("synthetic_data.csv", "
|
62 |
-
|
|
|
|
|
63 |
gr.Interface(
|
64 |
fn=generate,
|
65 |
inputs=[
|
@@ -69,7 +71,7 @@ gr.Interface(
|
|
69 |
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"),
|
70 |
gr.Slider(label="Repetition penalty", value=1.0, minimum=1.0, maximum=2.0, step=0.1, interactive=True, info="Penalize repeated tokens"),
|
71 |
],
|
72 |
-
outputs=gr.File(label="
|
73 |
title="Synthetic Data Generation",
|
74 |
description="This tool generates synthetic data from the sentences in your PDF and saves it to a CSV file.",
|
75 |
allow_flagging="never",
|
|
|
58 |
save_to_csv(sentence, f"Error: {e}")
|
59 |
|
60 |
# CSV dosyasını okuyup byte olarak döndür
|
61 |
+
with open("synthetic_data.csv", "r", encoding="utf-8") as file:
|
62 |
+
csv_content = file.read()
|
63 |
+
csv_bytes = csv_content.encode()
|
64 |
+
return io.BytesIO(csv_bytes)
|
65 |
gr.Interface(
|
66 |
fn=generate,
|
67 |
inputs=[
|
|
|
71 |
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"),
|
72 |
gr.Slider(label="Repetition penalty", value=1.0, minimum=1.0, maximum=2.0, step=0.1, interactive=True, info="Penalize repeated tokens"),
|
73 |
],
|
74 |
+
outputs=gr.File(label="Synthetic Data CSV"),
|
75 |
title="Synthetic Data Generation",
|
76 |
description="This tool generates synthetic data from the sentences in your PDF and saves it to a CSV file.",
|
77 |
allow_flagging="never",
|