Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -305,11 +305,31 @@ evaluator = load_evaluator("criteria", criteria="conciseness", llm=evaluation_ll
|
|
| 305 |
#Beschreibung oben in GUI
|
| 306 |
################################################
|
| 307 |
|
| 308 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 309 |
|
| 310 |
chatbot_stream = gr.Chatbot()
|
| 311 |
|
| 312 |
chat_interface_stream = gr.ChatInterface(fn=generate,
|
|
|
|
| 313 |
title = "ChatGPT vom LI",
|
| 314 |
theme="soft",
|
| 315 |
chatbot=chatbot_stream,
|
|
@@ -317,9 +337,9 @@ chat_interface_stream = gr.ChatInterface(fn=generate,
|
|
| 317 |
undo_btn="↩️ Letztes löschen",
|
| 318 |
clear_btn="🗑️ Verlauf löschen",
|
| 319 |
submit_btn = "Abschicken",
|
| 320 |
-
)
|
| 321 |
|
| 322 |
with gr.Blocks() as demo:
|
| 323 |
with gr.Tab("Chatbot"):
|
| 324 |
-
|
| 325 |
chat_interface_stream.queue().launch()
|
|
|
|
| 305 |
#Beschreibung oben in GUI
|
| 306 |
################################################
|
| 307 |
|
| 308 |
+
description = """<strong>Information:</strong> Hier wird ein <strong>Large Language Model (LLM)</strong> mit
|
| 309 |
+
<strong>Retrieval Augmented Generation (RAG)</strong> auf <strong>externen Daten</strong> verwendet.\n\n
|
| 310 |
+
"""
|
| 311 |
+
css = """.toast-wrap { display: none !important } """
|
| 312 |
+
examples=[['Was ist ChtGPT-4?'],['schreibe ein Python Programm, dass die GPT-4 API aufruft.']]
|
| 313 |
+
|
| 314 |
+
def vote(data: gr.LikeData):
|
| 315 |
+
if data.liked: print("You upvoted this response: " + data.value)
|
| 316 |
+
else: print("You downvoted this response: " + data.value)
|
| 317 |
+
|
| 318 |
+
additional_inputs = [
|
| 319 |
+
#gr.Radio(["Off", "Chroma", "MongoDB"], label="Retrieval Augmented Generation", value = "Off"),
|
| 320 |
+
gr.Radio(["Aus", "An"], label="RAG - LI Erweiterungen", value = "Aus"),
|
| 321 |
+
gr.Radio(["OpenAI", "HuggingFace"], label="Modellauswahl", value = "HuggingFace"),
|
| 322 |
+
gr.Textbox(label = "OpenAI API Key", value = "sk-", lines = 1),
|
| 323 |
+
gr.Slider(label="Temperature", value=0.65, minimum=0.0, maximum=1.0, step=0.05, interactive=True, info="Höhere Werte erzeugen diversere Antworten", visible=True),
|
| 324 |
+
gr.Slider(label="Max new tokens", value=1024, minimum=0, maximum=4096, step=64, interactive=True, info="Maximale Anzahl neuer Tokens", visible=True),
|
| 325 |
+
gr.Slider(label="Top-p (nucleus sampling)", value=0.6, minimum=0.0, maximum=1, step=0.05, interactive=True, info="Höhere Werte verwenden auch Tokens mit niedrigerer Wahrscheinlichkeit.", visible=True),
|
| 326 |
+
gr.Slider(label="Repetition penalty", value=1.2, minimum=1.0, maximum=2.0, step=0.05, interactive=True, info="Strafe für wiederholte Tokens", visible=True)
|
| 327 |
+
]
|
| 328 |
|
| 329 |
chatbot_stream = gr.Chatbot()
|
| 330 |
|
| 331 |
chat_interface_stream = gr.ChatInterface(fn=generate,
|
| 332 |
+
additional_inputs = additional_inputs,
|
| 333 |
title = "ChatGPT vom LI",
|
| 334 |
theme="soft",
|
| 335 |
chatbot=chatbot_stream,
|
|
|
|
| 337 |
undo_btn="↩️ Letztes löschen",
|
| 338 |
clear_btn="🗑️ Verlauf löschen",
|
| 339 |
submit_btn = "Abschicken",
|
| 340 |
+
description = description)
|
| 341 |
|
| 342 |
with gr.Blocks() as demo:
|
| 343 |
with gr.Tab("Chatbot"):
|
| 344 |
+
chatbot_stream.like(vote, None, None)
|
| 345 |
chat_interface_stream.queue().launch()
|