ysharma HF staff commited on
Commit
373f61d
1 Parent(s): 4b963fb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -97,7 +97,7 @@ def predict_alpha(message, chatbot=[], temperature=0.9, max_new_tokens=256, top_
97
  }
98
 
99
  try:
100
- response_data = post_request_beta(data)
101
  json_obj = response_data[0]
102
 
103
  if 'generated_text' in json_obj and len(json_obj['generated_text']) > 0:
@@ -122,7 +122,7 @@ def retry_fun_beta(chat_history_beta ):
122
  Retries the prediction for the last message in the chat history.
123
  Removes the last interaction and gets a new prediction for the same message from Zephyr-7b-Beta
124
  """
125
- if not chat_history or len(chat_history) < 1:
126
  raise gr.Error("Chat history is empty or invalid.")
127
 
128
  message = chat_history_beta[-1][0]
@@ -136,7 +136,7 @@ def retry_fun_alpha(chat_history_alpha ):
136
  Retries the prediction for the last message in the chat history.
137
  Removes the last interaction and gets a new prediction for the same message from Zephyr-7b-Alpha
138
  """
139
- if not chat_history or len(chat_history) < 1:
140
  raise gr.Error("Chat history is empty or invalid.")
141
 
142
  message = chat_history_alpha[-1][0]
@@ -144,6 +144,7 @@ def retry_fun_alpha(chat_history_alpha ):
144
  _, updated_chat_history_alpha = predict_alpha(message, chat_history_alpha)
145
  return updated_chat_history_alpha
146
 
 
147
  title = "🌀Zephyr Playground🎮"
148
  description = """
149
  Welcome to the Zephyr Playground! This interactive space lets you experience the prowess of two distinct Zephyr models – [Zephyr-7b-Alpha](https://huggingface.co/HuggingFaceH4/zephyr-7b-alpha) and [Zephyr-7b-Beta](https://huggingface.co/HuggingFaceH4/zephyr-7b-beta) – side by side. These models are products of fine-tuning the Mistral models.
 
97
  }
98
 
99
  try:
100
+ response_data = post_request_alpha(data)
101
  json_obj = response_data[0]
102
 
103
  if 'generated_text' in json_obj and len(json_obj['generated_text']) > 0:
 
122
  Retries the prediction for the last message in the chat history.
123
  Removes the last interaction and gets a new prediction for the same message from Zephyr-7b-Beta
124
  """
125
+ if not chat_history_beta or len(chat_history_beta) < 1:
126
  raise gr.Error("Chat history is empty or invalid.")
127
 
128
  message = chat_history_beta[-1][0]
 
136
  Retries the prediction for the last message in the chat history.
137
  Removes the last interaction and gets a new prediction for the same message from Zephyr-7b-Alpha
138
  """
139
+ if not chat_history_alpha or len(chat_history_alpha) < 1:
140
  raise gr.Error("Chat history is empty or invalid.")
141
 
142
  message = chat_history_alpha[-1][0]
 
144
  _, updated_chat_history_alpha = predict_alpha(message, chat_history_alpha)
145
  return updated_chat_history_alpha
146
 
147
+
148
  title = "🌀Zephyr Playground🎮"
149
  description = """
150
  Welcome to the Zephyr Playground! This interactive space lets you experience the prowess of two distinct Zephyr models – [Zephyr-7b-Alpha](https://huggingface.co/HuggingFaceH4/zephyr-7b-alpha) and [Zephyr-7b-Beta](https://huggingface.co/HuggingFaceH4/zephyr-7b-beta) – side by side. These models are products of fine-tuning the Mistral models.