edouardlgp commited on
Commit
760ba3d
·
verified ·
1 Parent(s): a7d834d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -24,7 +24,7 @@ class OllamaClient:
24
  print(f"Error listing models: {e}")
25
  return []
26
 
27
- def chat_completion(self, messages, max_tokens=4000, stream=True, temperature=0.3, top_p=0.9):
28
  # Convert messages to Ollama format
29
  ollama_messages = []
30
  for msg in messages:
@@ -343,9 +343,9 @@ with gr.Blocks(theme="gstaff/xkcd",
343
  title="Offline Sensitive Survey Data Analysis") as demo:
344
  gr.HTML(
345
  """
346
- <div style="text-align: center; max-width: 800px; margin: 0 auto;">
347
  <h1 style="font-size: 3em; font-weight: 600; margin: 0.5em;">Offline Sensitive Survey Data Analysis</h1>
348
- <h3 style="font-size: 1.2em; margin: 1em;">Leveraging Ollama Inference Server</h3>
349
  </div>
350
  """
351
  )
@@ -366,9 +366,9 @@ with gr.Blocks(theme="gstaff/xkcd",
366
  placeholder="Ask me anything about the uploaded data file... ",
367
  container=False
368
  )
369
- with gr.Row():
370
- clear = gr.ClearButton([msg, chatbot])
371
  send = gr.Button("Send")
 
372
 
373
  with gr.Column(scale=1):
374
  gr.Markdown("### Upload File \nSupport: CSV, Parquet files, Text")
@@ -384,13 +384,13 @@ with gr.Blocks(theme="gstaff/xkcd",
384
  choices=[],
385
  interactive=True
386
  )
387
- refresh_models = gr.Button("Refresh List of Models")
388
 
389
  with gr.Accordion("Advanced Settings ⚙️", open=False):
390
  system_message = gr.Textbox(label="Override System Message 📝", value="")
391
- max_tokens = gr.Slider(minimum=1, maximum=8000, value=4000, label="Max Tokens 📊")
392
- temperature = gr.Slider(minimum=0, maximum=1, value=0.3, label="Temperature 🌡️")
393
- top_p = gr.Slider(minimum=0, maximum=1, value=0.9, label="Top P 📈")
394
 
395
  # Function to load available models
396
  def load_models():
 
24
  print(f"Error listing models: {e}")
25
  return []
26
 
27
+ def chat_completion(self, messages, max_tokens=4000, stream=True, temperature=0.3, top_p=0.7):
28
  # Convert messages to Ollama format
29
  ollama_messages = []
30
  for msg in messages:
 
343
  title="Offline Sensitive Survey Data Analysis") as demo:
344
  gr.HTML(
345
  """
346
+ <div style="text-align: center; max-width: 1000px; margin: 0 auto;">
347
  <h1 style="font-size: 3em; font-weight: 600; margin: 0.5em;">Offline Sensitive Survey Data Analysis</h1>
348
+ <h3 style="font-size: 1.2em; margin: 1em;">Leveraging your Local Ollama Inference Server</h3>
349
  </div>
350
  """
351
  )
 
366
  placeholder="Ask me anything about the uploaded data file... ",
367
  container=False
368
  )
369
+ with gr.Row():
 
370
  send = gr.Button("Send")
371
+ clear = gr.ClearButton([msg, chatbot])
372
 
373
  with gr.Column(scale=1):
374
  gr.Markdown("### Upload File \nSupport: CSV, Parquet files, Text")
 
384
  choices=[],
385
  interactive=True
386
  )
387
+ refresh_models = gr.Button("Select Model")
388
 
389
  with gr.Accordion("Advanced Settings ⚙️", open=False):
390
  system_message = gr.Textbox(label="Override System Message 📝", value="")
391
+ max_tokens = gr.Slider(minimum=1, maximum=8000, value=4000, label="Max Tokens (maximum number of words for generated response)")
392
+ temperature = gr.Slider(minimum=0, maximum=1, value=0.3, label="Temperature (higher = more creative)")
393
+ top_p = gr.Slider(minimum=0, maximum=1, value=0.7, label="Top P (word choices by probability threshold)")
394
 
395
  # Function to load available models
396
  def load_models():