Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -297,7 +297,7 @@ def generate(history, text, rag_option, model_option, k=3, top_p=0.6, temperatu
|
|
297 |
raise gr.Error("Prompt ist erforderlich.")
|
298 |
|
299 |
try:
|
300 |
-
if (model_option == "
|
301 |
#Anfrage an InferenceEndpoint1 ----------------------------
|
302 |
API_URL = "https://api-inference.huggingface.co/models/HuggingFaceH4/zephyr-7b-beta"
|
303 |
print("HF1")
|
@@ -422,7 +422,7 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
|
|
422 |
with gr.Tab(label="Parameter Einstellung"):
|
423 |
gr.Markdown("# Parameters")
|
424 |
rag_option = gr.Radio(["Aus", "An"], label="RAG - LI Erweiterungen", value = "Aus")
|
425 |
-
model_option = gr.Radio(["
|
426 |
|
427 |
top_p = gr.Slider(
|
428 |
minimum=-0,
|
@@ -476,7 +476,7 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
|
|
476 |
max_length_tokens,
|
477 |
max_context_length_tokens,
|
478 |
],
|
479 |
-
outputs=[ chatbot,
|
480 |
show_progress=True,
|
481 |
)
|
482 |
|
@@ -486,13 +486,11 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
|
|
486 |
)
|
487 |
|
488 |
# Chatbot
|
489 |
-
transfer_input_args = dict(
|
490 |
-
fn=add_text, inputs=[chatbot, user_input], outputs=[chatbot, user_input], show_progress=True
|
491 |
-
)
|
492 |
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
|
497 |
cancelBtn.click(
|
498 |
cancel_outputing, [], [status_display],
|
|
|
297 |
raise gr.Error("Prompt ist erforderlich.")
|
298 |
|
299 |
try:
|
300 |
+
if (model_option == "HF1"):
|
301 |
#Anfrage an InferenceEndpoint1 ----------------------------
|
302 |
API_URL = "https://api-inference.huggingface.co/models/HuggingFaceH4/zephyr-7b-beta"
|
303 |
print("HF1")
|
|
|
422 |
with gr.Tab(label="Parameter Einstellung"):
|
423 |
gr.Markdown("# Parameters")
|
424 |
rag_option = gr.Radio(["Aus", "An"], label="RAG - LI Erweiterungen", value = "Aus")
|
425 |
+
model_option = gr.Radio(["HF1", "HF2"], label="Modellauswahl", value = "HF1")
|
426 |
|
427 |
top_p = gr.Slider(
|
428 |
minimum=-0,
|
|
|
476 |
max_length_tokens,
|
477 |
max_context_length_tokens,
|
478 |
],
|
479 |
+
outputs=[ chatbot, status_display], #[ chatbot, history, status_display],
|
480 |
show_progress=True,
|
481 |
)
|
482 |
|
|
|
486 |
)
|
487 |
|
488 |
# Chatbot
|
489 |
+
transfer_input_args = dict(fn=add_text, inputs=[chatbot, user_input], outputs=[chatbot, user_input], show_progress=True)
|
|
|
|
|
490 |
|
491 |
+
predict_event1 = user_input.submit(fn=add_text, inputs=[chatbot, user_input], outputs=[chatbot, user_input], queue=False,).then(**predict_args)
|
492 |
+
predict_event3 = btn.upload(add_file, [chatbot, btn, user_input], [chatbot, user_input],queue=False,).then(**predict_args)
|
493 |
+
predict_event2 = submitBtn.click(**transfer_input_args,queue=False,).then(**predict_args)
|
494 |
|
495 |
cancelBtn.click(
|
496 |
cancel_outputing, [], [status_display],
|