la04 commited on
Commit
15da3c5
·
verified ·
1 Parent(s): d14d249

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -42,6 +42,8 @@ def initialize_database(list_file_obj):
42
  def initialize_llmchain(llm_model, temperature, max_tokens, top_k, vector_db):
43
  if vector_db is None:
44
  return None, "Fehler: Keine Vektordatenbank verfügbar."
 
 
45
  llm = HuggingFaceEndpoint(
46
  repo_id=llm_model,
47
  huggingfacehub_api_token=api_token,
@@ -89,7 +91,7 @@ def demo():
89
 
90
  llm_btn = gr.Radio(["Flan-T5 Small", "Flan-T5 Base"], label="Verfügbare LLMs", value="Flan-T5 Small", type="index")
91
  slider_temperature = gr.Slider(0.01, 1.0, 0.5, label="Temperature")
92
- slider_maxtokens = gr.Slider(128, 2048, 512, label="Max Tokens")
93
  slider_topk = gr.Slider(1, 10, 3, label="Top-k")
94
  qachain_btn = gr.Button("Initialisiere QA-Chatbot")
95
  llm_status = gr.Textbox(label="Chatbot-Status", value="Nicht initialisiert", interactive=False)
 
42
  def initialize_llmchain(llm_model, temperature, max_tokens, top_k, vector_db):
43
  if vector_db is None:
44
  return None, "Fehler: Keine Vektordatenbank verfügbar."
45
+ if max_tokens > 250:
46
+ max_tokens = 250 # Begrenze max_new_tokens, um Fehler zu vermeiden
47
  llm = HuggingFaceEndpoint(
48
  repo_id=llm_model,
49
  huggingfacehub_api_token=api_token,
 
91
 
92
  llm_btn = gr.Radio(["Flan-T5 Small", "Flan-T5 Base"], label="Verfügbare LLMs", value="Flan-T5 Small", type="index")
93
  slider_temperature = gr.Slider(0.01, 1.0, 0.5, label="Temperature")
94
+ slider_maxtokens = gr.Slider(1, 250, 128, label="Max Tokens") # Begrenzung auf 250
95
  slider_topk = gr.Slider(1, 10, 3, label="Top-k")
96
  qachain_btn = gr.Button("Initialisiere QA-Chatbot")
97
  llm_status = gr.Textbox(label="Chatbot-Status", value="Nicht initialisiert", interactive=False)