TheMaisk commited on
Commit
8e9be96
·
verified ·
1 Parent(s): ce02bb0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -28
app.py CHANGED
@@ -8,54 +8,51 @@ def autocomplete(text):
8
  if text != "":
9
  response = client.chat.completions.create(
10
  model='gemma-7b-it',
11
- messages=[{"role": "user", "content": text}],
 
 
 
 
12
  stream=True
13
- )
14
 
15
  partial_message = ""
16
  for chunk in response:
17
  if chunk.choices[0].delta.content is not None:
18
- partial_message += chunk.choices[0].delta.content
19
  yield partial_message
20
-
21
  css = """
 
 
 
 
 
 
 
 
 
 
 
22
  .generating {
23
- display: none
24
  }
25
  """
26
 
27
- # Theme Definition
28
- theme = gr.themes.Default(
29
- primary_hue="neutral",
30
- secondary_hue=gr.themes.Color(
31
- secondary_100="#f1f5f9", secondary_200="#e2e8f0", secondary_300="#cbd5e1",
32
- secondary_400="#94adb8", secondary_50="#f8fafc", secondary_500="#65858b",
33
- secondary_600="#48626a", secondary_700="#345456", secondary_800="#1d343a",
34
- secondary_900="#0f2029", secondary_950="#0a1b1f"
35
- ),
36
- neutral_hue=gr.themes.Color(
37
- neutral_100="#f3f4f6", neutral_200="#e5e7eb", neutral_300="#d4d9dd",
38
- neutral_400="#9ca9b0", neutral_50="#f9fafb", neutral_500="#6b7780",
39
- neutral_600="#034054", neutral_700="#14161a", neutral_800="#0a0a0a",
40
- neutral_900="#19191a", neutral_950="#050505"
41
- )
42
- )
43
-
44
- # Create the Gradio interface with live updates
45
  iface = gr.Interface(
46
  fn=autocomplete,
47
  inputs=gr.Textbox(lines=2, placeholder="Hello 👋", label="Input Sentence"),
48
  outputs=gr.Markdown(),
49
  title="Frag mich einfach!",
50
  description="Powered by Groq",
51
- live=True,
52
  allow_flagging="never",
53
- css=css,
54
- theme=theme # Add the theme to your interface
55
  )
56
 
57
  iface.dependencies[0]['show_progress'] = "hidden"
58
  iface.dependencies[2]['show_progress'] = "hidden"
59
 
60
- # Launch the app
61
- iface.launch()
 
8
  if text != "":
9
  response = client.chat.completions.create(
10
  model='gemma-7b-it',
11
+ messages=[
12
+ {
13
+ "role": "user",
14
+ "content": text
15
+ }],
16
  stream=True
17
+ )
18
 
19
  partial_message = ""
20
  for chunk in response:
21
  if chunk.choices[0].delta.content is not None:
22
+ partial_message = partial_message + chunk.choices[0].delta.content
23
  yield partial_message
24
+
25
  css = """
26
+ body {
27
+ --color-bg-primary: #f8fafc; /* secondary_50 als Hintergrundfarbe */
28
+ --color-text-primary: #65858b; /* secondary_500 als Textfarbe */
29
+ --color-text-secondary: #48626a; /* secondary_600 für sekundären Text */
30
+ --color-border: #1d343a; /* secondary_800 für Grenzen und Linien */
31
+ --color-button-bg: #cbd5e1; /* secondary_300 für Button-Hintergrund */
32
+ --color-button-hover-bg: #94adb8; /* secondary_400 für Button-Hover-Hintergrund */
33
+ --color-button-text: #0f2029; /* secondary_900 für Button-Text */
34
+ font-family: Arial, sans-serif;
35
+ }
36
+
37
  .generating {
38
+ display: none;
39
  }
40
  """
41
 
42
+ # Erstelle die Gradio-Schnittstelle
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  iface = gr.Interface(
44
  fn=autocomplete,
45
  inputs=gr.Textbox(lines=2, placeholder="Hello 👋", label="Input Sentence"),
46
  outputs=gr.Markdown(),
47
  title="Frag mich einfach!",
48
  description="Powered by Groq",
49
+ live=True,
50
  allow_flagging="never",
51
+ css=css
 
52
  )
53
 
54
  iface.dependencies[0]['show_progress'] = "hidden"
55
  iface.dependencies[2]['show_progress'] = "hidden"
56
 
57
+ # Starte die Anwendung
58
+ iface.launch()