Spaces:
Sleeping
Sleeping
user message and history
Browse files
app.py
CHANGED
|
@@ -68,8 +68,8 @@ def generate_and_tokenize_prompt(data_point):
|
|
| 68 |
# result["labels"] = result["input_ids"].copy()
|
| 69 |
return result
|
| 70 |
|
| 71 |
-
def bot(
|
| 72 |
-
|
| 73 |
data = {
|
| 74 |
'instruction': "Jika Anda seorang dokter, silakan menjawab pertanyaan medis berdasarkan deskripsi pasien.",
|
| 75 |
'input': user_message,
|
|
@@ -105,11 +105,8 @@ def bot(user_message,temperature, max_new_tokens, top_p,top_k):
|
|
| 105 |
#history[-1] = response.split("Tanggapan:")[1].strip()
|
| 106 |
#return history
|
| 107 |
response=response.split("Tanggapan:")[1].strip()
|
| 108 |
-
history[-1][1] =
|
| 109 |
-
|
| 110 |
-
history[-1][1] += character
|
| 111 |
-
time.sleep(0.05)
|
| 112 |
-
yield history
|
| 113 |
|
| 114 |
|
| 115 |
with gr.Blocks() as demo:
|
|
|
|
| 68 |
# result["labels"] = result["input_ids"].copy()
|
| 69 |
return result
|
| 70 |
|
| 71 |
+
def bot(history,temperature, max_new_tokens, top_p,top_k):
|
| 72 |
+
user_message = history[-1][0]
|
| 73 |
data = {
|
| 74 |
'instruction': "Jika Anda seorang dokter, silakan menjawab pertanyaan medis berdasarkan deskripsi pasien.",
|
| 75 |
'input': user_message,
|
|
|
|
| 105 |
#history[-1] = response.split("Tanggapan:")[1].strip()
|
| 106 |
#return history
|
| 107 |
response=response.split("Tanggapan:")[1].strip()
|
| 108 |
+
history[-1][1] = response
|
| 109 |
+
return history
|
|
|
|
|
|
|
|
|
|
| 110 |
|
| 111 |
|
| 112 |
with gr.Blocks() as demo:
|