TheMaisk commited on
Commit
7da1d50
·
verified ·
1 Parent(s): 2f05b2d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -6
app.py CHANGED
@@ -2,15 +2,12 @@ import gradio as gr
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,7 +15,6 @@ def format_prompt(message, history):
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,11 +46,11 @@ mychatbot = gr.Chatbot(
50
  avatar_images=["./user.png", "./botm.png"], bubble_full_width=False, show_label=False, show_copy_button=True, likeable=True,
51
  )
52
 
53
-
54
  logo_html = gr.HTML(
55
  value='<div style="text-align: center; margin-bottom: 10px;">'
56
  '<img src="https://einfachalex.net/wp-content/uploads/2024/02/ealogo.png" alt="Logo" style="max-width: 100px;">'
57
  '</div>'
 
58
 
59
  demo = gr.ChatInterface(
60
  fn=generate,
@@ -66,4 +62,3 @@ demo = gr.ChatInterface(
66
  )
67
 
68
  demo.queue().launch(show_api=False)
69
-
 
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
 
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
  avatar_images=["./user.png", "./botm.png"], bubble_full_width=False, show_label=False, show_copy_button=True, likeable=True,
47
  )
48
 
 
49
  logo_html = gr.HTML(
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
+ ) # Hinzugefügt: Schließende Klammer hier
54
 
55
  demo = gr.ChatInterface(
56
  fn=generate,
 
62
  )
63
 
64
  demo.queue().launch(show_api=False)