Intellectualtech commited on
Commit
77e115a
·
verified ·
1 Parent(s): 6c968b2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -49,8 +49,8 @@ def respond(
49
  raise ValueError("Input message cannot be empty")
50
  if max_tokens < 1 or max_tokens > 2048:
51
  raise ValueError("max_tokens must be between 1 and 2048")
52
- if temperature < 0.1 or temperature > 4.0:
53
- raise ValueError("temperature must be between 0.1 and 4.0")
54
  if top_p < 0.1 or top_p > 1.0:
55
  raise ValueError("top_p must be between 0.1 and 1.0")
56
 
@@ -91,7 +91,7 @@ def main():
91
  "Be supportive, professional, and engaging in all interactions."
92
  )
93
 
94
- # Create Gradio ChatInterface with customized settings for students
95
  demo = gr.ChatInterface(
96
  fn=respond,
97
  additional_inputs=[
@@ -133,9 +133,6 @@ def main():
133
  "Adjust the settings to customize how I respond to your questions."
134
  ),
135
  theme="soft",
136
- submit_btn="Ask Question",
137
- retry_btn="Try Again",
138
- clear_btn="Clear Chat",
139
  css="""
140
  .gradio-container { max-width: 900px; margin: auto; padding: 20px; }
141
  .chatbot { border-radius: 12px; background-color: #f9fafb; }
@@ -153,4 +150,4 @@ def main():
153
  raise
154
 
155
  if __name__ == "__main__":
156
- main()
 
49
  raise ValueError("Input message cannot be empty")
50
  if max_tokens < 1 or max_tokens > 2048:
51
  raise ValueError("max_tokens must be between 1 and 2048")
52
+ if temperature < 0.1 or temperature > 2.0:
53
+ raise ValueError("temperature must be between 0.1 and 2.0")
54
  if top_p < 0.1 or top_p > 1.0:
55
  raise ValueError("top_p must be between 0.1 and 1.0")
56
 
 
91
  "Be supportive, professional, and engaging in all interactions."
92
  )
93
 
94
+ # Create Gradio ChatInterface with settings compatible with older Gradio versions
95
  demo = gr.ChatInterface(
96
  fn=respond,
97
  additional_inputs=[
 
133
  "Adjust the settings to customize how I respond to your questions."
134
  ),
135
  theme="soft",
 
 
 
136
  css="""
137
  .gradio-container { max-width: 900px; margin: auto; padding: 20px; }
138
  .chatbot { border-radius: 12px; background-color: #f9fafb; }
 
150
  raise
151
 
152
  if __name__ == "__main__":
153
+ main()