Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -86,65 +86,75 @@ def reset_chat():
|
|
| 86 |
with gr.Blocks(theme=small_and_beautiful_theme) as demo:
|
| 87 |
history = gr.State([])
|
| 88 |
user_question = gr.State("")
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
predict_args = dict(
|
| 149 |
fn=predict,
|
| 150 |
inputs=[
|
|
@@ -159,21 +169,21 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
|
|
| 159 |
outputs=[chatbotGr, history, status_display],
|
| 160 |
show_progress=True,
|
| 161 |
)
|
| 162 |
-
|
| 163 |
#neuer Chat
|
| 164 |
reset_args = dict(
|
| 165 |
fn=reset_chat, inputs=[], outputs=[user_input, status_display]
|
| 166 |
)
|
| 167 |
-
|
| 168 |
# Chatbot
|
| 169 |
transfer_input_args = dict(
|
| 170 |
fn=transfer_input, inputs=[user_input], outputs=[user_question, user_input, submitBtn], show_progress=True
|
| 171 |
)
|
| 172 |
-
|
| 173 |
#Listener auf Start-Click auf Button oder Return
|
| 174 |
predict_event1 = user_input.submit(**transfer_input_args).then(**predict_args)
|
| 175 |
predict_event2 = submitBtn.click(**transfer_input_args).then(**predict_args)
|
| 176 |
-
|
| 177 |
#Listener, Wenn reset...
|
| 178 |
emptyBtn.click(
|
| 179 |
reset_state,
|
|
|
|
| 86 |
with gr.Blocks(theme=small_and_beautiful_theme) as demo:
|
| 87 |
history = gr.State([])
|
| 88 |
user_question = gr.State("")
|
| 89 |
+
gr.Markdown("KIs am LI - wähle aus, was du mahen möchtest!")
|
| 90 |
+
with gr.Tabs():
|
| 91 |
+
with gr.TabItem("LI-Chat"):
|
| 92 |
+
with gr.Row():
|
| 93 |
+
gr.HTML(title)
|
| 94 |
+
status_display = gr.Markdown("Erfolg", elem_id="status_display")
|
| 95 |
+
gr.Markdown(description_top)
|
| 96 |
+
with gr.Row(scale=1).style(equal_height=True):
|
| 97 |
+
with gr.Column(scale=5):
|
| 98 |
+
with gr.Row(scale=1):
|
| 99 |
+
chatbotGr = gr.Chatbot(elem_id="LI_chatbot").style(height="100%")
|
| 100 |
+
with gr.Row(scale=1):
|
| 101 |
+
with gr.Column(scale=12):
|
| 102 |
+
user_input = gr.Textbox(
|
| 103 |
+
show_label=False, placeholder="Gib deinen Text / Frage ein."
|
| 104 |
+
).style(container=False)
|
| 105 |
+
with gr.Column(min_width=90, scale=1):
|
| 106 |
+
submitBtn = gr.Button("Absenden")
|
| 107 |
+
with gr.Column(min_width=90, scale=1):
|
| 108 |
+
cancelBtn = gr.Button("Stoppen")
|
| 109 |
+
with gr.Row(scale=1):
|
| 110 |
+
emptyBtn = gr.Button(
|
| 111 |
+
"🧹 Neuer Chat",
|
| 112 |
+
)
|
| 113 |
+
with gr.Column():
|
| 114 |
+
with gr.Column(min_width=50, scale=1):
|
| 115 |
+
with gr.Tab(label="Parameter zum Model"):
|
| 116 |
+
gr.Markdown("# Parameters")
|
| 117 |
+
top_p = gr.Slider(
|
| 118 |
+
minimum=-0,
|
| 119 |
+
maximum=1.0,
|
| 120 |
+
value=0.95,
|
| 121 |
+
step=0.05,
|
| 122 |
+
interactive=True,
|
| 123 |
+
label="Top-p",
|
| 124 |
+
)
|
| 125 |
+
temperature = gr.Slider(
|
| 126 |
+
minimum=0.1,
|
| 127 |
+
maximum=2.0,
|
| 128 |
+
value=1,
|
| 129 |
+
step=0.1,
|
| 130 |
+
interactive=True,
|
| 131 |
+
label="Temperature",
|
| 132 |
+
)
|
| 133 |
+
max_length_tokens = gr.Slider(
|
| 134 |
+
minimum=0,
|
| 135 |
+
maximum=512,
|
| 136 |
+
value=512,
|
| 137 |
+
step=8,
|
| 138 |
+
interactive=True,
|
| 139 |
+
label="Max Generation Tokens",
|
| 140 |
+
)
|
| 141 |
+
max_context_length_tokens = gr.Slider(
|
| 142 |
+
minimum=0,
|
| 143 |
+
maximum=4096,
|
| 144 |
+
value=2048,
|
| 145 |
+
step=128,
|
| 146 |
+
interactive=True,
|
| 147 |
+
label="Max History Tokens",
|
| 148 |
+
)
|
| 149 |
+
gr.Markdown(description)
|
| 150 |
+
|
| 151 |
+
with gr.TabItem("Übersetzungen"):
|
| 152 |
+
with gr.Row():
|
| 153 |
+
gr.HTML("Hier entsteht ein Übersetzer mit KI...")
|
| 154 |
+
with gr.TabItem("Code-genereierungen"):
|
| 155 |
+
with gr.Row():
|
| 156 |
+
gr.HTML("Hier entsteht eine KI zum Programmieren...")
|
| 157 |
+
|
| 158 |
predict_args = dict(
|
| 159 |
fn=predict,
|
| 160 |
inputs=[
|
|
|
|
| 169 |
outputs=[chatbotGr, history, status_display],
|
| 170 |
show_progress=True,
|
| 171 |
)
|
| 172 |
+
|
| 173 |
#neuer Chat
|
| 174 |
reset_args = dict(
|
| 175 |
fn=reset_chat, inputs=[], outputs=[user_input, status_display]
|
| 176 |
)
|
| 177 |
+
|
| 178 |
# Chatbot
|
| 179 |
transfer_input_args = dict(
|
| 180 |
fn=transfer_input, inputs=[user_input], outputs=[user_question, user_input, submitBtn], show_progress=True
|
| 181 |
)
|
| 182 |
+
|
| 183 |
#Listener auf Start-Click auf Button oder Return
|
| 184 |
predict_event1 = user_input.submit(**transfer_input_args).then(**predict_args)
|
| 185 |
predict_event2 = submitBtn.click(**transfer_input_args).then(**predict_args)
|
| 186 |
+
|
| 187 |
#Listener, Wenn reset...
|
| 188 |
emptyBtn.click(
|
| 189 |
reset_state,
|