vpcom commited on
Commit
dc956e2
1 Parent(s): b183974

fix: find a temporary workaround for the history and prompt

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -16,6 +16,9 @@ FORCE_PUSH = os.getenv("FORCE_PUSH")
16
  BOT_NAME = "PersianGPT-FT"
17
  PUSH_FREQUENCY = 60 # every minute
18
 
 
 
 
19
  DATA_FILENAME = "data.jsonl"
20
  DATA_FILE = os.path.join("data", DATA_FILENAME)
21
  repo = Repository(local_dir="data", clone_from=DATASET_REPO_URL, use_auth_token=HF_TOKEN)
@@ -78,6 +81,9 @@ def format_prompt(message, history, system_prompt):
78
  def generate(
79
  prompt, history, system_prompt, temperature=0.9, max_new_tokens=100, top_p=0.95, repetition_penalty=1.0, seed=42,
80
  ):
 
 
 
81
  temperature = float(temperature)
82
  if temperature < 1e-2:
83
  temperature = 1e-2
@@ -208,8 +214,8 @@ def vote(data: gr.LikeData):
208
  json.dumps(
209
  {
210
  "time_stamp": time.time(),
211
- "prompt": chat_interface.saved_input,
212
- "history": chat_interface.textbox,
213
  "system prompt": additional_inputs[0].value,
214
  "temperature": additional_inputs[1].value,
215
  "max_new_tokens": additional_inputs[2].value,
 
16
  BOT_NAME = "PersianGPT-FT"
17
  PUSH_FREQUENCY = 60 # every minute
18
 
19
+ HISTORY = ""
20
+ PROMPT = ""
21
+
22
  DATA_FILENAME = "data.jsonl"
23
  DATA_FILE = os.path.join("data", DATA_FILENAME)
24
  repo = Repository(local_dir="data", clone_from=DATASET_REPO_URL, use_auth_token=HF_TOKEN)
 
81
  def generate(
82
  prompt, history, system_prompt, temperature=0.9, max_new_tokens=100, top_p=0.95, repetition_penalty=1.0, seed=42,
83
  ):
84
+ HISTORY = history
85
+ PROMPT = prompt
86
+
87
  temperature = float(temperature)
88
  if temperature < 1e-2:
89
  temperature = 1e-2
 
214
  json.dumps(
215
  {
216
  "time_stamp": time.time(),
217
+ "prompt": PROMPT,
218
+ "history": HISTORY,
219
  "system prompt": additional_inputs[0].value,
220
  "temperature": additional_inputs[1].value,
221
  "max_new_tokens": additional_inputs[2].value,