darkc0de commited on
Commit
4455ff2
Β·
verified Β·
1 Parent(s): 317ad44

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -15
app.py CHANGED
@@ -11,9 +11,8 @@ if api_url is None:
11
  raise ValueError("API_URL environment variable not set. Please create a .env file with API_URL.")
12
 
13
  client = InferenceClient(api_url)
14
- FIXED_MAX_TOKENS = 2048
15
- FIXED_TEMPERATURE = 0.9
16
- FIXED_TOP_P = 0.95
17
 
18
  # SYSTEM_PROMPT has been entirely removed as requested.
19
 
@@ -33,10 +32,8 @@ def respond(message, history):
33
  try:
34
  for chunk in client.chat.completions.create(
35
  messages=messages,
36
- max_tokens=FIXED_MAX_TOKENS,
37
  stream=True,
38
- temperature=FIXED_TEMPERATURE,
39
- top_p=FIXED_TOP_P,
40
  ):
41
  if chunk.choices[0].delta.content is not None:
42
  token = chunk.choices[0].delta.content
@@ -45,7 +42,7 @@ def respond(message, history):
45
  except Exception as e:
46
  yield f"An error occurred: {e}"
47
 
48
- header_image_path = "https://cdn-uploads.huggingface.co/production/uploads/6540a02d1389943fef4d2640/j61iZTDaK9g0UW3aWGwWi.gif"
49
  kofi_script = """
50
  <script src='https://storage.ko-fi.com/cdn/scripts/overlay-widget.js'></script>
51
  <script>
@@ -82,14 +79,7 @@ body, .gradio-container {
82
  """
83
 
84
  with gr.Blocks(theme="dark", head=kofi_script, css=custom_css) as demo:
85
- gr.Image(
86
- value=header_image_path,
87
- label="Chatbot Header",
88
- show_label=False,
89
- interactive=False,
90
- height=100,
91
- elem_id="chatbot-logo"
92
- )
93
 
94
  gr.ChatInterface(
95
  fn=respond,
 
11
  raise ValueError("API_URL environment variable not set. Please create a .env file with API_URL.")
12
 
13
  client = InferenceClient(api_url)
14
+
15
+ # FIXED_MAX_TOKENS, FIXED_TEMPERATURE, FIXED_TOP_P have been removed.
 
16
 
17
  # SYSTEM_PROMPT has been entirely removed as requested.
18
 
 
32
  try:
33
  for chunk in client.chat.completions.create(
34
  messages=messages,
 
35
  stream=True,
36
+ # max_tokens, temperature, and top_p are removed from here
 
37
  ):
38
  if chunk.choices[0].delta.content is not None:
39
  token = chunk.choices[0].delta.content
 
42
  except Exception as e:
43
  yield f"An error occurred: {e}"
44
 
45
+ # header_image_path has been removed.
46
  kofi_script = """
47
  <script src='https://storage.ko-fi.com/cdn/scripts/overlay-widget.js'></script>
48
  <script>
 
79
  """
80
 
81
  with gr.Blocks(theme="dark", head=kofi_script, css=custom_css) as demo:
82
+ # gr.Image component has been removed.
 
 
 
 
 
 
 
83
 
84
  gr.ChatInterface(
85
  fn=respond,