ramalMr commited on
Commit
acf104d
·
verified ·
1 Parent(s): d53066f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
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
- # Geçici dosya oluştur ve CSV yazıcısını başlat
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]) # Orijinal cümle ve yanıt CSV'ye yazılır
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 CSV"),
72
- title="Synthetic Data Generation",
73
- description="This tool generates synthetic data from the sentences in your PDF and saves it to a CSV file.",
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()