Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,7 @@ app = gr.load(
|
|
15 |
]
|
16 |
).launch()
|
17 |
"""
|
18 |
-
|
19 |
# Pipeline
|
20 |
|
21 |
import gradio as gr
|
@@ -39,4 +39,25 @@ app = gr.Interface(
|
|
39 |
examples = [
|
40 |
["Hello, World."]
|
41 |
]
|
42 |
-
).launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
]
|
16 |
).launch()
|
17 |
"""
|
18 |
+
"""
|
19 |
# Pipeline
|
20 |
|
21 |
import gradio as gr
|
|
|
39 |
examples = [
|
40 |
["Hello, World."]
|
41 |
]
|
42 |
+
).launch()
|
43 |
+
"""
|
44 |
+
|
45 |
+
from huggingface_hub import InferenceClient
|
46 |
+
|
47 |
+
#client = InferenceClient(api_key="YOUR_HF_TOKEN")
|
48 |
+
|
49 |
+
messages = [
|
50 |
+
{ "role": "user", "content": "Tell me a story" }
|
51 |
+
]
|
52 |
+
|
53 |
+
stream = client.chat.completions.create(
|
54 |
+
model="google/gemma-2-2b-it",
|
55 |
+
messages=messages,
|
56 |
+
temperature=0.5,
|
57 |
+
max_tokens=2048,
|
58 |
+
top_p=0.7,
|
59 |
+
stream=True
|
60 |
+
)
|
61 |
+
|
62 |
+
for chunk in stream:
|
63 |
+
print(chunk.choices[0].delta.content)
|