DeepLearning101 commited on
Commit
64ecf55
·
verified ·
1 Parent(s): b2ba30a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -115,7 +115,12 @@ def save_feedback(user_input, response, feedback_type, improvement):
115
  "improvement": [improvement]
116
  }
117
  global dataset
118
- feedback_dataset = dataset["feedback"].add_item(new_data)
 
 
 
 
 
119
  dataset.push_to_hub(DATASET_NAME)
120
 
121
  def handle_feedback(response, feedback_type, improvement):
@@ -133,12 +138,14 @@ def handle_user_input(user_input):
133
  def show_feedback():
134
  try:
135
  feedbacks = dataset["feedback"].to_pandas().to_dict(orient="records")
 
136
  return feedbacks
137
  except Exception as e:
138
- return f"Error: {e}"
 
139
 
140
  TITLE = """<h1 align="center">Large Language Model (LLM) Playground 💬 <a href='https://support.maicoin.com/zh-TW/support/home' target='_blank'>Cryptocurrency Exchange FAQ</a></h1>"""
141
- SUBTITLE = """<h2 align="center"><a href='https://www.twman.org' target='_blank'>TonTon Huang Ph.D. @ 2024/07 </a><br></h2>"""
142
  LINKS = """<a href='https://blog.twman.org/2021/04/ASR.html' target='_blank'>那些語音處理 (Speech Processing) 踩的坑</a> | <a href='https://blog.twman.org/2021/04/NLP.html' target='_blank'>那些自然語言處理 (Natural Language Processing, NLP) 踩的坑</a> | <a href='https://blog.twman.org/2024/02/asr-tts.html' target='_blank'>那些ASR和TTS可能會踩的坑</a> | <a href='https://blog.twman.org/2024/02/LLM.html' target='_blank'>那些大模型開發會踩的坑</a> | <a href='https://blog.twman.org/2023/04/GPT.html' target='_blank'>什麼是大語言模型,它是什麼?想要嗎?</a><br>
143
  <a href='https://blog.twman.org/2023/07/wsl.html' target='_blank'>用PaddleOCR的PPOCRLabel來微調醫療診斷書和收據</a> | <a href='https://blog.twman.org/2023/07/HugIE.html' target='_blank'>基於機器閱讀理解和指令微調的統一信息抽取框架之診斷書醫囑資訊擷取分析</a><br>"""
144
 
 
115
  "improvement": [improvement]
116
  }
117
  global dataset
118
+ dataset["feedback"] = Dataset.from_dict({
119
+ "user_input": dataset["feedback"]["user_input"] + [user_input],
120
+ "response": dataset["feedback"]["response"] + [response],
121
+ "feedback_type": dataset["feedback"]["feedback_type"] + [feedback_type],
122
+ "improvement": dataset["feedback"]["improvement"] + [improvement]
123
+ })
124
  dataset.push_to_hub(DATASET_NAME)
125
 
126
  def handle_feedback(response, feedback_type, improvement):
 
138
  def show_feedback():
139
  try:
140
  feedbacks = dataset["feedback"].to_pandas().to_dict(orient="records")
141
+ print(f"Feedbacks: {feedbacks}") # Debug information
142
  return feedbacks
143
  except Exception as e:
144
+ print(f"Error: {e}") # Debug information
145
+ return {"error": str(e)}
146
 
147
  TITLE = """<h1 align="center">Large Language Model (LLM) Playground 💬 <a href='https://support.maicoin.com/zh-TW/support/home' target='_blank'>Cryptocurrency Exchange FAQ</a></h1>"""
148
+ SUBTITLE = """<h2 align="center"><a href='https://www.twman.org' target='_blank'>TonTon Huang Ph.D. @ 2024/06 </a><br></h2>"""
149
  LINKS = """<a href='https://blog.twman.org/2021/04/ASR.html' target='_blank'>那些語音處理 (Speech Processing) 踩的坑</a> | <a href='https://blog.twman.org/2021/04/NLP.html' target='_blank'>那些自然語言處理 (Natural Language Processing, NLP) 踩的坑</a> | <a href='https://blog.twman.org/2024/02/asr-tts.html' target='_blank'>那些ASR和TTS可能會踩的坑</a> | <a href='https://blog.twman.org/2024/02/LLM.html' target='_blank'>那些大模型開發會踩的坑</a> | <a href='https://blog.twman.org/2023/04/GPT.html' target='_blank'>什麼是大語言模型,它是什麼?想要嗎?</a><br>
150
  <a href='https://blog.twman.org/2023/07/wsl.html' target='_blank'>用PaddleOCR的PPOCRLabel來微調醫療診斷書和收據</a> | <a href='https://blog.twman.org/2023/07/HugIE.html' target='_blank'>基於機器閱讀理解和指令微調的統一信息抽取框架之診斷書醫囑資訊擷取分析</a><br>"""
151