Spaces:
Sleeping
Sleeping
File size: 1,777 Bytes
a20cb09 8e9be96 a20cb09 8e9be96 ce02bb0 a20cb09 8e9be96 a20cb09 8e9be96 2a0bd98 8e9be96 2a0bd98 8e9be96 2a0bd98 f341970 ce02bb0 8e9be96 a20cb09 049dfe8 8bd5c9a 836f722 049dfe8 f341970 ce02bb0 f341970 a20cb09 ce02bb0 2a0bd98 a20cb09 8e9be96 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
import os
import gradio as gr
from groq import Groq
client = Groq(api_key=os.getenv('GROQ_API_KEY'))
def autocomplete(text):
if text != "":
response = client.chat.completions.create(
model='gemma-7b-it',
messages=[
{
"role": "user",
"content": text
}],
stream=True
)
partial_message = ""
for chunk in response:
if chunk.choices[0].delta.content is not None:
partial_message = partial_message + chunk.choices[0].delta.content
yield partial_message
css = """
body {
--color-bg-primary: #f8fafc; /* secondary_50 als Hintergrundfarbe */
--color-text-primary: #65858b; /* secondary_500 als Textfarbe */
--color-text-secondary: #48626a; /* secondary_600 für sekundären Text */
--color-border: #1d343a; /* secondary_800 für Grenzen und Linien */
--color-button-bg: #cbd5e1; /* secondary_300 für Button-Hintergrund */
--color-button-hover-bg: #94adb8; /* secondary_400 für Button-Hover-Hintergrund */
--color-button-text: #0f2029; /* secondary_900 für Button-Text */
font-family: Arial, sans-serif;
}
.generating {
display: none;
}
"""
theme = 'syddharth/gray-minimal'
# Erstelle die Gradio-Schnittstelle
iface = gr.Interface(
fn=autocomplete,
inputs=gr.Textbox(lines=2, placeholder="Hallo 👋", label="Frag mich"),
outputs=gr.Markdown(),
title="",
description="",
live=True,
allow_flagging="never",
css=css,
theme=theme # Hier fügst du das Theme hinzu
)
iface.dependencies[0]['show_progress'] = "hidden"
iface.dependencies[2]['show_progress'] = "hidden"
# Starte die Anwendung
iface.launch()
|