Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,12 +2,15 @@ import gradio as gr
|
|
2 |
from huggingface_hub import InferenceClient
|
3 |
import os
|
4 |
|
|
|
|
|
5 |
client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
6 |
prompt_secret = os.environ.get('PROMPT_SECRET')
|
7 |
|
8 |
def format_prompt(message, history):
|
9 |
prompt = prompt_secret + "In Ihrer ersten Interaktion fragen Sie nach spezifischen Anforderungen des Entwicklungsprojekts."
|
10 |
|
|
|
11 |
for user_prompt, bot_response in history:
|
12 |
prompt += f"[INST] {user_prompt} [/INST]"
|
13 |
prompt += f" {bot_response}</s> "
|
@@ -15,6 +18,7 @@ def format_prompt(message, history):
|
|
15 |
|
16 |
return prompt
|
17 |
|
|
|
18 |
def generate(
|
19 |
prompt, history, temperature=0.2, max_new_tokens=512, top_p=0.95, repetition_penalty=1.0,
|
20 |
):
|
@@ -46,11 +50,7 @@ mychatbot = gr.Chatbot(
|
|
46 |
avatar_images=["./user.png", "./botm.png"], bubble_full_width=False, show_label=False, show_copy_button=True, likeable=True,
|
47 |
)
|
48 |
|
49 |
-
|
50 |
-
value='<div style="text-align: center; margin-bottom: 10px;">'
|
51 |
-
'<img src="https://einfachalex.net/wp-content/uploads/2024/02/ealogo.png" alt="Logo" style="max-width: 100px;">'
|
52 |
-
'</div>'
|
53 |
-
)
|
54 |
|
55 |
demo = gr.ChatInterface(
|
56 |
fn=generate,
|
@@ -58,11 +58,7 @@ demo = gr.ChatInterface(
|
|
58 |
title="Einfach Mixtral",
|
59 |
retry_btn=None,
|
60 |
undo_btn=None,
|
61 |
-
theme="syddharth/gray-minimal"
|
62 |
)
|
63 |
|
64 |
-
|
65 |
-
logo_html
|
66 |
-
demo
|
67 |
-
|
68 |
-
app.launch(show_api=False)
|
|
|
2 |
from huggingface_hub import InferenceClient
|
3 |
import os
|
4 |
|
5 |
+
|
6 |
+
|
7 |
client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
8 |
prompt_secret = os.environ.get('PROMPT_SECRET')
|
9 |
|
10 |
def format_prompt(message, history):
|
11 |
prompt = prompt_secret + "In Ihrer ersten Interaktion fragen Sie nach spezifischen Anforderungen des Entwicklungsprojekts."
|
12 |
|
13 |
+
|
14 |
for user_prompt, bot_response in history:
|
15 |
prompt += f"[INST] {user_prompt} [/INST]"
|
16 |
prompt += f" {bot_response}</s> "
|
|
|
18 |
|
19 |
return prompt
|
20 |
|
21 |
+
|
22 |
def generate(
|
23 |
prompt, history, temperature=0.2, max_new_tokens=512, top_p=0.95, repetition_penalty=1.0,
|
24 |
):
|
|
|
50 |
avatar_images=["./user.png", "./botm.png"], bubble_full_width=False, show_label=False, show_copy_button=True, likeable=True,
|
51 |
)
|
52 |
|
53 |
+
|
|
|
|
|
|
|
|
|
54 |
|
55 |
demo = gr.ChatInterface(
|
56 |
fn=generate,
|
|
|
58 |
title="Einfach Mixtral",
|
59 |
retry_btn=None,
|
60 |
undo_btn=None,
|
61 |
+
theme="syddharth/gray-minimal" # Hinzufügen des Themes hier
|
62 |
)
|
63 |
|
64 |
+
demo.queue().launch(show_api=False)
|
|
|
|
|
|
|
|