sainathBelagavi commited on
Commit
263c6c5
·
verified ·
1 Parent(s): 53746df

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -17
app.py CHANGED
@@ -106,26 +106,17 @@ if prompt := st.chat_input(f"Hi I'm {selected_model}, How can I help you today?"
106
 
107
  formatted_text = format_prompt(prompt, conversation_history, custom_instruction)
108
 
109
- max_tokens = {
110
- "LegacyLift🚀": 32000,
111
- "ModernMigrate⭐": 8192,
112
- "RetroRecode🔄": 4096
113
- }
114
-
115
- # Calculate available tokens for new content
116
- input_tokens = len(formatted_text.split())
117
- max_new_tokens = max_tokens[selected_model] - input_tokens
118
-
119
- # Ensure max_new_tokens is within the model's limit
120
- if selected_model == "RetroRecode🔄":
121
- max_new_tokens = min(max_new_tokens, 3000)
122
-
123
  with st.chat_message("assistant"):
124
- client = InferenceClient(
125
- model=model_links[selected_model], )
126
  output = client.text_generation(
127
  formatted_text,
128
- temperature=temp_values, # 0.5
129
  max_new_tokens=max_new_tokens,
130
  stream=True
131
  )
 
106
 
107
  formatted_text = format_prompt(prompt, conversation_history, custom_instruction)
108
 
109
+ max_new_tokens = 3000
110
+ if selected_model != "RetroRecode🔄":
111
+ input_tokens = len(formatted_text.split())
112
+ max_tokens = {"LegacyLift🚀": 32000, "ModernMigrate⭐": 8192}
113
+ max_new_tokens = max_tokens[selected_model] - input_tokens
114
+
 
 
 
 
 
 
 
 
115
  with st.chat_message("assistant"):
116
+ client = InferenceClient(model=model_links[selected_model])
 
117
  output = client.text_generation(
118
  formatted_text,
119
+ temperature=temp_values,
120
  max_new_tokens=max_new_tokens,
121
  stream=True
122
  )